> The first frustration is that I can't get the transaction details scan > to get any more accurate. It thinks it will find 1407 records, > instead it finds 20,153. Then for whatever reason it thinks that a > join between 1 record and 1407 records will return 1 record. This is > mainly what I can't understand. Why does it think it will only get > one record in response when it's a left join?
I don't see any left join there ...
> PG 8.2.4 on Linux kernel 2.6.9 x64
The first thing you should do is update to 8.2.6; we've fixed a fair number of problems since then that were fallout from the outer-join planning rewrite in 8.2.
If it still doesn't work very well, please post the pg_stats rows for the join columns involved (idatrndtl.ida_trans_match_source_id and mtchsrcprj3.id). (You do have up-to-date ANALYZE stats for both of those tables, right?)
regards, tom lane
Thanks Tom, we will try the upgrade and see if that makes a difference.