Subject Re: [firebird-support] query speed - confusing
Author Nick Upson
2009/8/12 Svein Erling Tysvær <svein.erling.tysvaer@...>:
> Why? You're only selecting the first 25 and using the UNQ_TBLOUTSTATION_2 index, Firebird doesn't have to check whether there are more than these 25 rows that meet the criteria.

I thought it would be selecting all rows that meet the criteria, then
sorting to determine the first 25

>
> HTH,
> Set
>
> -----Original Message-----
> From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Nick Upson
> Sent: 12. august 2009 15:35
> To: firebird-support@yahoogroups.com
> Subject: Re: [firebird-support] query speed - confusing
>
> 2009/8/12 Anderson Farias <peixedragao@...>:
>> Hi,
>>
>>
>> About the 1st query:
>>
>>>PLAN JOIN (JOIN (JOIN (O NATURAL, OM INDEX (FK_TBLOSMETRIC_1)),
>>>E INDEX (IDX_TBLELEMENT_1)), A INDEX (PK_TBLASSET))
>>
>> O NATURAL is not a good thing, and thats becouse:
>>
>>> WHERE O.ACTIVESTATUS = 0 AND UPPER(O.OSIDENT) STARTING WITH '110';
>>
>> You probably have (or should have) an Index on O.OSIDENT which can't be used
>> becouse of UPPER() function. Ether don't use the function (having a
>> secondary fields filled by a trigger is an option) or create a expression
>> index on UPPER(O.OSIDENT)
>>
>>
>> Regards,
>> Anderson
>
> the thing is that except for doing select f1, f2, f3 instead of select
> count(*) and the ordering the 2 queries are the same. If anything I
> would expect the count(*) to be quicker than the other one.
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu.  Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>
>