Subject | RE: [ib-support] slow execution of LIKE |
---|---|
Author | Thomas Steinmaurer |
Post date | 2002-07-07T13:03:45Z |
Hello Ben,
whether an index is used depends how the input parameter SSTRING
looks like!
For example LIKE '%GLAX%' doesn't use an index, whereas LIKE 'GLAX%'
does, because LIKE 'GLAX%' is internally changed to STARTING WITH,
which uses an index.
HTH,
Thomas Steinmaurer
IB LogManager 2.0 - The Logging/Auditing Tool for InterBase and Firebird
http://www.iblogmanager.com
whether an index is used depends how the input parameter SSTRING
looks like!
For example LIKE '%GLAX%' doesn't use an index, whereas LIKE 'GLAX%'
does, because LIKE 'GLAX%' is internally changed to STARTING WITH,
which uses an index.
HTH,
Thomas Steinmaurer
IB LogManager 2.0 - The Logging/Auditing Tool for InterBase and Firebird
http://www.iblogmanager.com
> -----Original Message-----
> From: Ben Johnson [mailto:ben_johns@...]
> Sent: Sunday, July 07, 2002 2:56 PM
> To: ib-support@yahoogroups.com
> Subject: [ib-support] slow execution of LIKE
>
>
> Hi,
>
> The following SP takes 00:00:00:0831 seconds to
> execute.
>
> If I change LIKE :sString to LIKE 'GLAX%', it takes
> only 00:00:00:0050 seconds to execute!
>
> Can somebody tell me any other alternative.
>
> create procedure PHARMA_MASTER_LOOKUP (
> SSTRING varchar(50))
> returns (
> PHARMA_NM varchar(40),
> ID decimal(5, 0))
> as
> BEGIN
> FOR SELECT pharma_nm, id
> FROM pharma
> WHERE pharma_nm LIKE :sString
> ORDER BY pharma_nm
> INTO :pharma_nm, :id
> DO
> SUSPEND;
> END
>
>
> Thank you
>
> Ben
>
> _________________________________________________________
> There is always a better job for you at Monsterindia.com.
> Go now http://monsterindia.rediff.com/jobs
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>