Subject | Re: Slow descending order select on joint tables |
---|---|
Author | Sean |
Post date | 2006-09-19T14:24:04Z |
--- In firebird-support@yahoogroups.com, "Leyne, Sean" <Sean@...> wrote:
query above, a plan was printed in IBExpert:
PLAN SORT (JOIN (TABLE_A NATURAL,TABLE_B INDEX (PK_TABLE_B)))
So the descending index is not used in the query...
>Yes, a full join of two tables is what I want to. When running the
> Sean, (What a great name!)
>
> > I need to furtherly join table_A to a small table with only 5 records.
> > Now the query is revised as:
> >
> > select first 250 * from table_A A
> > left join table_B B
> > on A.column = B.column
> > where A.time > sometimestamp
> > order by A.ID desc
> >
> > Now it takes more than 1 minute :-(
> >
> > Can anyone please point out what is missing here?
>
> The FIRST predicate is evaluated based on the *results*.
>
> So, you're query is performing a full join for both tables, then
> returning the first 250 rows.
>
>
> Sean
>
query above, a plan was printed in IBExpert:
PLAN SORT (JOIN (TABLE_A NATURAL,TABLE_B INDEX (PK_TABLE_B)))
So the descending index is not used in the query...