pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Christopher Browne <cbbrowne@acm.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: R: R: slow seqscan after vacuum analize
Date: Thu, 05 Feb 2004 12:09:49 -0500
Message-ID: <4193.1076000989@sss.pgh.pa.us> (raw)
In-Reply-To: <m3d68unops.fsf@wolfe.cbbrowne.com>
References: <Pine.LNX.4.58.0402042115370.6678@shishi.roaringpenguin.com>
	<2s28b9$kqpmo@mailr-1.tiscali.it>
	<m3d68unops.fsf@wolfe.cbbrowne.com>

Christopher Browne <cbbrowne@acm.org> writes:
> Another factor worth considering: If a few values are very common in
> the field you are selecting on, then the query optimizer can get
> convinced (wrongly) that a Seq Scan is the best choice.  Using ALTER
> TABLE T ALTER COLUMN C SET STATISTICS [some value] to increase the
> number of "bins" can be helpful in such cases.  (My pet theory is that
> the present default value of 10 is a little low, and that a lot of
> optimizer errors might be resolved by bumping it up a bit...)

I also suspect that 10 is a lowball figure, but no one has done any work
to establish what might be a more reasonable default.  Larger values
have real costs in both pg_statistic space and planner runtime, so I
don't want to push it up without some kind of evidence.

BTW, if you think a higher default might be appropriate, you can set it
in postgresql.conf instead of running around and manually ALTERing all
your tables.

			regards, tom lane



view thread (9+ messages)  latest in thread

Message-ID: <4193.1076000989@sss.pgh.pa.us>
Permalink:  ../4193.1076000989@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4193.1076000989@sss.pgh.pa.us

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cbbrowne@acm.org
  Subject: Re: R: R: slow seqscan after vacuum analize
  In-Reply-To: <4193.1076000989@sss.pgh.pa.us>
  References: <Pine.LNX.4.58.0402042115370.6678@shishi.roaringpenguin.com> <2s28b9$kqpmo@mailr-1.tiscali.it> <m3d68unops.fsf@wolfe.cbbrowne.com> <4193.1076000989@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