Subject Re: [firebird-support] Problem with sub-optimal query plan
Author Tim Ward
On 03/02/2015 17:05, Fulvio Senore mailing@... [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