Subject RE: [firebird-support] HOWTo PLAN Clause for FB2
Author Alan McDonald
> Alan McDonald wrote:
> >
> > But I'd still like to know the syntax for incorporating a
> plan (which
> > has more than one index nominated) in a select statement.
>
> Plan belongs to a select expression. In other words, this
> means a subquery.
>
> > What is the correct syntax?
>
> SELECT ...
> , (SELECT COUNT(*) FROM ERSCONTRACTORALERTS
> WHERE ERSCONTRACTORALERTS.FKCONTRACTOR=ERSCONTRACTOR.ID
> PLAN (ERSCONTRACTORALERTS INDEX (...)) ) AS ALERTCOUNT
> , (SELECT COUNT(*) FROM ERSJOB
> WHERE ERSJOB.FKCONTRACTOR=ERSCONTRACTOR.ID AND
> ERSJOB.COMDATE
> IS NULL
> PLAN (ERSJOB INDEX (...)) ) AS INCOMPJOBS
>
> ...
> FROM ERSCONTRACTOR
> WHERE ...
> PLAN (ERSCONTRACTOR INDEX (...))
>
>
> Dmitry


Why does the server return the plan in a list which is not correlated (order
wise) with the select expressions?
Alan