| From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
|---|---|
| To: | Maksim Likharev <mlikharev(at)aurigin(dot)com> |
| Cc: | <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Statistics on a table |
| Date: | 2003-07-09 02:53:28 |
| Message-ID: | 20030708195151.C5781-100000@megazone23.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Tue, 8 Jul 2003, Maksim Likharev wrote:
> Hi,
> I just found very interesting situation,
> statistic ( n_distinct in particular) records for one of my columns,
> greatly under calculated it saying:
>
> 49726, but in reality 33409816.
>
> So planer never choose index but rather using table scan, and query
> never returns,
> 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?
> I can turn seqscan off but is it safe?
It's somewhat of a large hammer, especially if you're doing joins with
this table or something.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | The Hermit Hacker | 2003-07-09 03:35:13 | PostgreSQL Advocacy Fund and New Banner Ads |
| Previous Message | Timothy Brier | 2003-07-09 02:16:21 | Restoring a postgres database |