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 Lonergan||Date: 2007-10-27 19:12:06|
|Subject: Re: partitioned table and ORDER BY indexed_field DESC
|Previous:||From: Heikki Linnakangas||Date: 2007-10-27 09:11:32|
|Subject: Re: partitioned table and ORDER BY indexed_field DESC LIMIT