Subject slow join?
Author bwc3068
Hi--

I'm by no means a SQl expert and I have a question about a query.

FB 2.1

Here's the query:

Select P.*, E.uniqueKey from Parts P
Inner Join ReliefD E
on (p.repairEntryKey = E.UniqueKey)
order by
P.UniqueKey

On a database with 44,000 ReliefD records and 321,000 Parts records (the result of the query is about 300,000 records) it resolves (or displays the first page of results in the grid) in a matter of 45ish seconds.

On a different database file with 41,000 ReliefD records and 422,000 Parts records (the result of the query is 421,000 records) it takes 25 minutes to show the first page of results in the grid.

This is on the same PC with the exact same stuff running in the background (not much).

Same indexs, same tables, same records, etc. Just different data.

There is a P.RepairEntryKey for every record in Parts and that field is indexed.

There is a E.UniqueKey for every record in ReliefD and that field is the primary key.

There is a P.UniqueKey for every record in Parts and that is the primary key of that table.

And every record in the Parts table does have a record in ReliefD BUT the reverse is not true (not all ReliefD records have Parts records)

Thoughts on the speed difference? Could it really be 325,000 vs. 425,000 records his some sort of big threshold?

TIA!!!
Kelly