Subject RE: [firebird-support] Why PLAN token is not allowed after ORDER BY?
Author Svein Erling Tysvær
>I consider this issue resolved with one side note that having PLAN hint which affects ORDER BY execution
>before ORDER BY clause is misleading.

Don't forget UNION, Alec. I.e.

select * from T
where a = 1
PLAN (T INDEX (IDX_TA))
union
select * from T
where a = 2
PLAN (T INDEX (IDX_TA))
order by 1

makes it quite simple to see why the PLAN clause has to be before the ORDER BY. Of course, I have no problems understanding that having the option of specifying ORDER BY before PLAN in simple selects could be easier to read (particularly when the plan involves ORDER as opposed to INDEX).

Set