Subject Re: [firebird-support] Re: LIKE operator inside stored procedure
Author Martijn Tonies
Hi Dorin,

It's slightly more complex/different ;-)

> Simple
> Because, speaking of execution plan, the value can't be known at
> compile time.
> It can be '%something%' at runtime, so index optimization is not
> possible.

The execution plan isn't created at compile time (= creating
BLR for the procedure/SQL), but only at execution time.
However, parameters are not bound when
creating the execution plan. So when a value holds:
LIKE 'A%', the optimizer can switch to use indices, while
when using a parameter:
LIKE :param - it doesn't know it's value yet, so it decides
not to use an index.


With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com