Dmitry, If you look at the plans in my original post they both have "PHYSICAL_COPY ORDER "IDX_214/CmDhH936xtHXcXNQKg==" INDEX" just like you suggested. Sorry for the misleading table and index names.
Once again, the plan I used was generated by FB query optimizer itself! I did NOT create it by hand. What I did was this: 1. Ran a query which does "A LEFT JOIN B ORDER BY X" and copied the plan that FB generated. 2. Changed the query to "A INNER JOIN B ORDER BY X PLAN P", where P is the plan generated by FB in #1. Received "Unexpected token PLAN" error. 3. Change the query to "A INNER JOIN B PLAN P ORDER BY X" - success! Why does #3 succeed but #2 fail? Thanks, Alec On Sat, Jun 2, 2012 at 3:17 PM, Dmitry Kuzmenko <[email protected]> wrote: > ** > > > Hello, Alec! > > AS> The question is why FB complains about PLAN token after ORDER BY > clause? > > the answer is that PLAN is wrong. ORDER BY in query affects PLAN, it > will contain PLAN SORT or TABLE ORDER INDEX specification. Your PLAN > specification is crap, sorry for rude answer. > As I said before, you need to know how Firebird produces plan > specification and how it accepts it. > > -- > Dmitry Kuzmenko, www.ib-aid.com > > > [Non-text portions of this message have been removed] ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
