Dne 19.5.2011 23:13, Strange, John W napsal(a):
> Am I reading this right in that the sort is taking almost 8 seconds?
You're probably reading it wrong. The sort itself takes about 1 ms (just
subtract the numbers in "actual="). If you include all the overhead it
takes about 2.3 seconds (the hash join ends at 12 sec, the sort at 14.3).
Anyway, your real problem is probably stale stats. Run ANALYZE on the
tables referenced in the query, the estimates are very off. All the rows
expect 1 row but are getting 315k of them.
regards
Tomas