Re: Speed difference between select ... union select ... and select from partitioned_table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pablo Alcaraz <pabloa(at)laotraesquina(dot)com(dot)ar>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Speed difference between select ... union select ... and select from partitioned_table
Date: 2007-10-27 13:15:02
Message-ID: 14887.1193490902@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Pablo Alcaraz <pabloa(at)laotraesquina(dot)com(dot)ar> writes:
> These are the EXPLAIN ANALIZE:

If you raise work_mem enough to let the second query use a hash
aggregate (probably a few MB would do it), I think it'll be about
the same speed as the first one.

The reason it's not picking that on its own is the overestimate
of the number of resulting groups. This is because
get_variable_numdistinct is not smart about append relations.
We should try to fix that sometime...

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Luke Lonergan 2007-10-27 19:12:06 Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1
Previous Message Heikki Linnakangas 2007-10-27 09:11:32 Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1