Subject Re: [IBO] SQL plan in TIBOQuery
Author hubert_krukowski <hubert@agb.com.pl>
--- In IBObjects@yahoogroups.com, Raymond Kennington <progsol@c...>
wrote:
> (I think Firebird's optimiser has been improved significantly, but
that won't
> help you unless you switch.)

My mistake - I have not provided you with this information - but I
have already tested it with Firebird 0.9-4 and 1.5. Same result.

> IBOQuery has the property Plan, instead of SQLPlan.

Not accessible, I am afraid.

> There is also an event OnPrepare... that might be useful to you. I
don't know if
> it has finished preparing or is fired after preparing (as the Help
file doesn't
> state this info).

And this is the direction I went. Right now in the OnPrepare event
depending on the active sorting I modify the SQL to specify a
correct plan for the one execeptional sorting order. I leave it with
no plan for all the other sorting orders that seem to work fine. I
do not insert the where clause - I rely on
OrderingLinks/OrderingItems feature to do that.
It seems to be working but it is kind of "dirty". Is there any way
to parse sql in TStrings and modify only a part of it? Something
like ParseSQL(ds->SQL).setPlan("sth"). Right now I have to to ds-
>SQL->Clear() and insert full sql with or without the plan. There
has to be a better way :-)

Regards,

Hubert Krukowski