From: Tom Lane <tgl@sss.pgh.pa.us>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: josh@agliodbs.com, Greg Stark <gsstark@mit.edu>
Cc: Marko Ristola <marko.ristola@kolumbus.fi>
Cc: pgsql-perform <pgsql-performance@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
Date: Mon, 25 Apr 2005 17:10:55 -0400
Message-ID: <24355.1114463455@sss.pgh.pa.us> (raw)
In-Reply-To: <1114454941.21529.245.camel@localhost.localdomain>
References: <200504191209.05181.josh@agliodbs.com>
<200504221336.08325.josh@agliodbs.com>
<8764ydapky.fsf@stark.xeocode.com>
<200504231639.11897.josh@agliodbs.com>
<1114419467.21529.210.camel@localhost.localdomain>
<19276.1114442580@sss.pgh.pa.us>
<1114454941.21529.245.camel@localhost.localdomain>
Simon Riggs <simon@2ndquadrant.com> writes:
> On Mon, 2005-04-25 at 11:23 -0400, Tom Lane wrote:
>> It's not just the scan --- you also have to sort, or something like
>> that, if you want to count distinct values. I doubt anyone is really
>> going to consider this a feasible answer for large tables.
> Assuming you don't use the HashAgg plan, which seems very appropriate
> for the task? (...but I understand the plan otherwise).
The context here is a case with a very large number of distinct
values... keep in mind also that we have to do this for *all* the
columns of the table. A full-table scan for each column seems
right out to me.
regards, tom lane
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, simon@2ndquadrant.com, gsstark@mit.edu, marko.ristola@kolumbus.fi, pgsql-hackers@postgresql.org
Subject: Re: [HACKERS] Bad n_distinct estimation; hacks suggested?
In-Reply-To: <24355.1114463455@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