On 03/02/2015 17:05, Fulvio Senore [email protected] [firebird-support] wrote: > Thank you, using a left outer join did the trick! > Now the query uses the descending index and it is much faster. > > I agree that it is not an optimal solution but for this database an > outer join will return the same rows as an inner join (no nulls) so it > solves my problem. Sometimes it's the other way around - replacing an outer join with an inner join goes orders of magnitude faster (again, as in this case, you have to convince yourself first that you're going to get the same results).
In an ideal world, changing the spelling of a query without changing its meaning would not have any effect on the query plan generated, but we are where we are, and it's sometimes useful to be able to prod it in a different direction. Such tricks are not, of course, going to be portable between database engines. -- Tim Ward ------------------------------------ ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ------------------------------------ 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: https://info.yahoo.com/legal/us/yahoo/utos/terms/
