Re: Why sequential scan???
Posted in 2000
Topics: Performance & Tuning, SQL Development & Query Writing, Triggers, Constraints & Referential Integrity
From: larsen@qec.com (Jeff Larsen)
>
>Why is the subquery in the query below doing
>a sequential scan? The column "driver" has a
>foreign key constraint and is thus indexed.
>
>
>QUERY:
>------
>select message, driver, type, data
> from raco_message rm where status = 0
> and message = (select min(message) from raco_message
> where driver = rm.driver)>
>
>Estimated Cost: 3
>Estimated # of Rows Returned: 1
>
>1) qdb.rm: INDEX PATH
>
> Filters: (qdb.rm.status = 0 AND qdb.rm.message = <subquery> )
>
> (1) Index Keys: driver
>
> Subquery:
> ---------
> Estimated Cost: 2
> Estimated # of Rows Returned: 1
>
> 1) qdb.raco_message: SEQUENTIAL SCAN
>
> Filters: qdb.raco_message.driver = qdb.rm.driver
UPDATE STATISTICS?
How many rows in the raco_message table?
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Have you tried an order by xxx where xxx is the indexed column?