Subject Re: [firebird-support] Order by
Author Sandeep Chandra
Sorry for last email. Pressed send too early.

Alan McDonald wrote:

>>I have a query which gets data from 2 tables. Number of records read is
>>45 without order by clause, as soon as I put order by clause it goes to
>>360. In both cases the profile says "Indexed Reads".
>>
>>This is slowing the server and all the workstations.
>>
>>Why is this happening? How do I fix this so that other workstations are
>>not slowed down.
>>
>>Regards
>>
>>Sandeep
>>
>>
>
>fascinating - but tell us the query, query plan, table structure,
>application language, connection libraries etc - tell us something so we can
>make an educated guess as to what is happening - on the face of it I'd say
>"impossible!"
>

Using Delphi, IBO (using queries not table)

_________________________________________________________________

for First case (Records read 45)

SQL is
select cln.*, anm.*
from "Client_Main" cln left outer join "Animal_Main" anm
on anm."Owner" = cln."Ref_Number"
where cln."FName" starting with 'SA'

Plan is
[PLAN JOIN (CLN INDEX (CLN_BY_FNAME),ANM INDEX (Anm_By_Owner))]

_________________________________________________________________
for Second case (Records read 360)

SQL is
select cln.*, anm.*
from "Client_Main" cln left outer join "Animal_Main" anm
on anm."Owner" = cln."Ref_Number"
where cln."FName" starting with 'SA'
order by cln."FName" desc

Plan is [PLAN SORT (JOIN (CLN INDEX (CLN_BY_FNAME),ANM INDEX
(Anm_By_Owner)))]

Regards

Sandeep