pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pablo Alcaraz <pabloa@laotraesquina.com.ar>
Cc: pgsql-performance@postgresql.org
Subject: Re: Speed difference between select ... union select ... and select from partitioned_table
Date: Sat, 27 Oct 2007 09:15:02 -0400
Message-ID: <14887.1193490902@sss.pgh.pa.us> (raw)
In-Reply-To: <4722C92D.8050501@laotraesquina.com.ar>
References: <47225014.5040101@laotraesquina.com.ar>
	<1193432821.7624.83.camel@dogma.ljc.laika.com>
	<4722C92D.8050501@laotraesquina.com.ar>

Pablo Alcaraz <pabloa@laotraesquina.com.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



view thread (8+ messages)  latest in thread

Message-ID: <14887.1193490902@sss.pgh.pa.us>
Permalink:  ../14887.1193490902@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14887.1193490902@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pabloa@laotraesquina.com.ar
  Subject: Re: Speed difference between select ... union select ... and select from partitioned_table
  In-Reply-To: <14887.1193490902@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox