QUESTION POSED ON: 16 May 2007
I have a SQL statement that is behaving differently in two "equal" databases (equal in schema, but size differs by about 50%). Here's the statement:
select distinct 99, 31, b.school_id, a.provider_id,
a.student_id, '2007', lpad('01',2,'0'), '0'
from studprovider a, student b, school c where
a.student_id = b.student_id and
b.school_id = c.school_id and
a.provider_id = 527 and
b.t_districtid = 31 and
b.status = '1';
When I run Explain Plan in database A, there is a full table scan on student. But when I run the explain on database B I get no full table scan, which is what I want. Why the difference in optimizers? Do the number of data rows in the student table make the difference?
|