Subject RE: [firebird-support] use of 'LIKE %'
Author Vahan Yoghoudjian
The number of records in the table may vary from 10,000 to 100,000
according to the customers we have... and yes the number of status is small,
there are 6 types of status.
Would it be better not to use an index on this field?

-----Original Message-----
[]On Behalf Of Dimitry Sibiryakov
Sent: Thursday, April 21, 2005 12:11 PM
Subject: Re: [firebird-support] use of 'LIKE %'

On 21 Apr 2005 at 9:16, Vahan Yoghoudjian wrote:

>Is this a bad habit? Would it be better to change 'where status like
>:ItemStatus' to 'where status = :ItemStatus' and omit this condition
>part when all items have to be fetched or Firebird ignores conditions
>like 'LIKE %' since all records have to be fetched anyway?

It would be some better. Or not. Your current use of LIKE doesn't
allow FB to use index on field status if any, so FB scan whole table.
On the other hand, the index may make things worse if number of
different statuses is small because it add scan of the index to
(almost) full scan of the table.
I'm afraid, only experiment may show whether if LIKE is suitable in
this case or not.
SY, Dimitry Sibiryakov.

Yahoo! Groups Links

a.. To visit your group on the web, go to:

b.. To unsubscribe from this group, send an email to:

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

[Non-text portions of this message have been removed]