Subject | Parameterised like query won't use index in the plan |
---|---|
Author | roydamman |
Post date | 2012-10-29T22:02:20Z |
Hello,
I have table with an indexed field (Firebird 2.1/2.5). When I use the query:
select * from mytable where myfield like 'test'
the plan uses the index on myfield and the query returns quickly.
When I use the query:
select * from mytable where myfield like :myparameter
and define myparameter = 'test'
the plan doesn't use the index (natural) and my query returns slowly.
The big question is: What am I doing wrong? Any help is appreciated.
Regards,
Roy Damman
I have table with an indexed field (Firebird 2.1/2.5). When I use the query:
select * from mytable where myfield like 'test'
the plan uses the index on myfield and the query returns quickly.
When I use the query:
select * from mytable where myfield like :myparameter
and define myparameter = 'test'
the plan doesn't use the index (natural) and my query returns slowly.
The big question is: What am I doing wrong? Any help is appreciated.
Regards,
Roy Damman