Re: queries with lots of UNIONed relations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: queries with lots of UNIONed relations
Date: 2011-01-13 20:05:44
Message-ID: 4879.1294949144@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jon Nelson <jnelson+pgsql(at)jamponi(dot)net> writes:
> Your comment regarding "each individual de-duplication looked like it
> would fit in work_mem" doesn't really make sense, exactly. Maybe I'm
> misunderstanding you.

Yeah. What I was suggesting was to NOT add the DISTINCT's, but instead
raise work_mem high enough so you get just one HashAggregation step at
the top level. (Although I think this only works in 8.4 and up.)
That should be faster than two levels of de-duplication.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jon Nelson 2011-01-13 20:12:43 Re: queries with lots of UNIONed relations
Previous Message Jon Nelson 2011-01-13 19:54:03 Re: queries with lots of UNIONed relations