Re: Speed difference between select ... union select ... and select from partitioned_table - Mailing list pgsql-performance

From Tom Lane
Subject Re: Speed difference between select ... union select ... and select from partitioned_table
Date
Msg-id 14887.1193490902@sss.pgh.pa.us
Whole thread Raw
In response to Re: Speed difference between select ... union select ... and select from partitioned_table  (Pablo Alcaraz <pabloa@laotraesquina.com.ar>)
List pgsql-performance
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

pgsql-performance by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1
Next
From: "Luke Lonergan"
Date:
Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT 1