Re: [PERFORM] Bad n_distinct estimation; hacks suggested? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PERFORM] Bad n_distinct estimation; hacks suggested?
Date
Msg-id 24355.1114463455@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PERFORM] Bad n_distinct estimation; hacks suggested?  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: [PERFORM] Bad n_distinct estimation; hacks suggested?
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: "Dave Held"
Date:
Subject: Re: [PERFORM] Bad n_distinct estimation; hacks suggested?
Next
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Continue transactions after errors in psql