Jon Nelson <jnelson+pgsql@xxxxxxxxxxx> writes: > In the former case, the query plan was a bitmap heap scan for each > table. Then those results were Appended, Sorted, Uniqued, Sorted > again, and then returned. > In the latter, before Appending, each table's results were run through > HashAggregate. Probably the reason it did that is that each individual de-duplication looked like it would fit in work_mem, but a single de-duplication didn't. Consider raising work_mem, at least for this one query. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance