Re: more problems with count(*) on large table

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: more problems with count(*) on large table
Date: 2007-09-28 17:10:32
Message-ID: 20070928171032.GQ7912@crankycanuck.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 28, 2007 at 12:50:34PM -0400, Alvaro Herrera wrote:
>
> But he does have a WHERE condition. THe problem is, probably, that the
> condition is not selective enough so the planner chooses to do a
> seqscan.

Or else the planner has a bad idea of how selective the condition is.
I've found that this sort of inconsistent selectivity on an indexed
column can be because the column statistics aren't good enough. You
can try ALTER TABLE...SET STATISTICS to see if it helps.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
This work was visionary and imaginative, and goes to show that visionary
and imaginative work need not end up well.
--Dennis Ritchie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2007-09-28 17:54:42 Re: more problems with count(*) on large table
Previous Message Scott Ribe 2007-09-28 17:09:47 Triggers & inheritance