Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-performance by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group