Re: Statistics on a table

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: Maksim Likharev <mlikharev(at)aurigin(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Statistics on a table
Date: 2003-07-09 06:32:49
Message-ID: 28754.1057732369@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
>> statistic ( n_distinct in particular) records for one of my columns,
>> greatly under calculated it saying:
>> 49726, but in reality 33409816.
>> is it any way how I can improve that?

> You might see if raising the statistics target with ALTER TABLE ALTER
> COLUMN followed by an analyze helps getting reasonable values any. Maybe
> try a few thousand?

That seems like a big jump, considering the default is only 10. Try
setting it to 100 (then re-ANALYZE, then check the plan). If that
doesn't work, try more. I'd be interested to see what it takes to
get the estimate closer to reality.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Maksim Likharev 2003-07-09 06:41:01 Re: Statistics on a table
Previous Message Bruce Momjian 2003-07-09 06:25:40 Upcoming events