Subject Re: [Firebird-Architect] "Adapted" PLAN for parametrized LIKE queries
Author Dmitry Yemanov
14.03.2012 14:26, Alex Peshkoff wrote:

> What if there are >1 places in the query where execution plan can
> differ? Looks like we get exponential growth of memory used for such
> prepared queries if we duplicate all plan. Or may be we talk about
> having a kind of "if" inside the plan?

The latter of course. Only a small subset (single table access in our
case) is made conditional.

> But looks like in the worst case
> all plan can change depending upon use or not index in one place.

This could be a problem if such conditional retrievals are used inside
joins etc, especially if the predicate is a part of the relationship
condition. We cannot estimate the cost properly at the prepare time. Of
course we could suppose the worst case or use some average cost, but
it's still something sub-optimal. More brainstorming is required here.