Subject Re: Performance with joins and order by
Author Christian Kaufmann
Hi Arno

> The Query with the ORDER BY (SORT in PLAN) first fetch all results
> internally and perform a sort on the results. After that only 25

That's what I thought.

> If you really need a fast behaviour for this you can create a single
> index on RI.PLACE, but probably better is a compound index on
> RANKINGID, PLACE and but it in the same order in the ORDER BY

I already had an index on RANKINGID,PLACE. So I added RANKINGID to the
order clause and now the query seems really faster. The plan is:

PLAN JOIN (RI ORDER IX_RANKINGITEM_WORLD,SR INDEX (PK_SWIMRESULT),A
INDEX (PK_ATHLETE),C INDEX (PK_CLUB))

So RANKINGID in the order clause seems to be important, even if all
records to retreive have the same value for it.

Thanks for the quick answer.

cu Christian