Re: [firebird-support] Problem with sub-optimal query plan

2015-02-03 Thread Tim Ward t...@telensa.com [firebird-support]
On 03/02/2015 17:05, Fulvio Senore mail...@fsoft.it [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 sa

Re: [firebird-support] Problem with sub-optimal query plan

2015-02-03 Thread Fulvio Senore mail...@fsoft.it [firebird-support]
Il 03/02/2015 14:41, Ann Harrison aharri...@ibphoenix.com [firebird-support] ha scritto: > >> On Feb 3, 2015, at 8:17 AM, Fulvio Senore mail...@fsoft.it >> [firebird-support] wrote: >> >> I want to retrieve rows showing INVOICES data and some CUSTOMERS data so >> I use an inner join, and I wan

Re: [firebird-support] Problem with sub-optimal query plan

2015-02-03 Thread Fulvio Senore mail...@fsoft.it [firebird-support]
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. Again, thank you for you

Re: [firebird-support] Problem with sub-optimal query plan

2015-02-03 Thread Ann Harrison aharri...@ibphoenix.com [firebird-support]
> On Feb 3, 2015, at 8:17 AM, Fulvio Senore mail...@fsoft.it [firebird-support] > wrote: > > I want to retrieve rows showing INVOICES data and some CUSTOMERS data so > I use an inner join, and I want to see newer invoices first so I add an > ORDER BY clause. I only need a few rowssince I will

Re: [firebird-support] Problem with sub-optimal query plan

2015-02-03 Thread Tim Ward t...@telensa.com [firebird-support]
You could try an outer join ... mucky in the extreme but it sometimes forces the optimiser to look at the sane table first ... (yes I know one shouldn't have to do that sort of thing). On 03/02/2015 12:17, Fulvio Senore mail...@fsoft.it [firebird-support] wrote: > I have a database containing(s

[firebird-support] Problem with sub-optimal query plan

2015-02-03 Thread Fulvio Senore mail...@fsoft.it [firebird-support]
I have a database containing(simplifyinga little) a CUSTOMERS table andan INVOICES table. INVOICES contains a foreign key to CUSTOMERS, as you can expect. I want to retrieve rows showing INVOICES data and some CUSTOMERS data so I use an inner join, and I want to see newer invoices first so I add