Don't forget to cc the list
Enrico wrote:
On Wed, 03 Jan 2007 10:55:03 +0000
Richard Huxton <dev@xxxxxxxxxxxx> wrote:
You're fetching all the rows from both tables - what would an index scan
gain you
there is a join
Yes, there is a join. Between all the rows in tmp_righe_bolle_carico
(tr) and all the matches in bolle_carico_testata (tb). It looks like
there is one row in (tb) that matches each in (tr).
What do you expect two index scans over both tables would gain you?
You seem to be saying that you think:
fetching 22420 index entries on tr + fetching 22420 rows in tr
+ fetching 22420 index entries on tb + fetching 22420 rows in tb
+ merge-join
would be faster than the hash-join you've got. I think it's unlikely
that's the case.
If you issue "set enable_seqscan = off" before the query that should
force it to use the indexes first. What does that plan show you?
--
Richard Huxton
Archonet Ltd