Subject | Re: Speed difference between = and LIKE |
---|---|
Author | simonbenedicic |
Post date | 2009-09-24T15:30:29Z |
--- In firebird-support@yahoogroups.com, "RB Smissaert" <bartsmissaert@...> wrote:
Note that if you use parameters, the usage of index might me different -> that is true for stored procedures. In below example compiler of stored procedure will not know (at compile time) if "%" is at the end or at the begining of parameter or both, so it will not use an index.
select field1 from table1 where field1 like :Param
... in that case it is better to use "starting with".
Regards,
Simon
>Hi,
>
> select field1 from table1 where field1 = 'abcde'
> select field1 from table1 where field1 like 'abcd%'
> select field1 from table1 where field1 starting with 'abcd'
>
> It looks not, but just want to make sure.
Note that if you use parameters, the usage of index might me different -> that is true for stored procedures. In below example compiler of stored procedure will not know (at compile time) if "%" is at the end or at the begining of parameter or both, so it will not use an index.
select field1 from table1 where field1 like :Param
... in that case it is better to use "starting with".
Regards,
Simon