"Nathan Boley" <nate.boley@xxxxxxxxx> writes: > Merge Join (cost=883182.60..1024622.03 rows=6873573 width=89) > Merge Cond: ("outer".pkeycolumn1 = "inner".pkey) > -> Sort (cost=93387.50..94711.01 rows=529404 width=18) > Sort Key: table2.pkey > -> Seq Scan on table2 (cost=0.00..15037.04 rows=529404 width=18) > -> Sort (cost=789795.10..795605.39 rows=2324116 width=81) > Sort Key: table1.pkeycolumn1 > -> Seq Scan on table1 (cost=0.00..71900.16 rows=2324116 width=81) > This seems like it *should* be the best query to me, but when I try and run > it it takes forever. What PG version is this, and what have you got work_mem (or sort_mem) set to? I'm betting the sorts are slow ... regards, tom lane