Subject Re: [firebird-support] Indexes and Plans
Author Dimitry Sibiryakov
On 18 Mar 2004 at 14:30, Epstein, Ed wrote:

>I have 2 different tables with a double precision field in each one. Both
>are indexed. I am trying to perform a query of the values that are in both
>tables.
>
>I have tried many variations, but this is the most logical one to me:
>
>SELECT * FROM TABLEA INNER JOIN TABLEB ON TABLEA.FIELD1 = TABLEB.FIELD1

Comaring two floating-point values for equality is a bad idea in
common.

>The Plan that is generated for that is (TableA Natural,TableB (Index
>TableB_Field1_A))
>
>Wouldn't the best plan be to use both indexes?

No, because you ask for ALL records.

>Basically I am trying to create the fastest query to return values from both
>tables that are the same. So far it takes at least 2-5 minutes which is not
>very good.

Probably, if you put smaller table to the first place in FROM
clause, it will help a bit.
BTW, do you count time of execution or execution+full fetch? Fetch
indeed may take much time if you ask for many wide fields. Note only
needed fields in fields list.

SY, Dimitry Sibiryakov.