Re: Statistics on a table

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

Tried 100 did not help, it seems like n_distinct grows 10000 per 10
statistic,
in my case to be close to reality I have to put 1000.
Is there any complications of that, I mean growing statistic depth other
then
disk space?

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, July 08, 2003 11:33 PM
To: Stephan Szabo
Cc: Maksim Likharev; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Statistics on a table

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

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-07-09 06:41:04 Re: Restoring a postgres database
Previous Message Tom Lane 2003-07-09 06:32:49 Re: Statistics on a table