Re: Trouble with index in 7.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gerry(dot)smit(at)lombard(dot)ca
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Trouble with index in 7.1
Date: 2002-05-16 04:32:50
Message-ID: 601.1021523570@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

gerry(dot)smit(at)lombard(dot)ca writes:
> Hi folks. We're having a baffling time with Postgres 7.1

Updating to 7.2 might help.

> cen_db=> explain select * from pol_xref_d where policy_no=1200079;

> Seq Scan on pol_xref_d (cost=0.00..22299.22 rows=8325 width=80)

> Sequential Scan !!!! Good God, why ?

Because it thinks a substantial fraction of your table will be visited
(note the rows=8325 estimate). My guess is that you have some one value
of policy_no that is extremely common, and that that is fooling the
7.1 planner into thinking the table contains only a few distinct values
of policy_no --- which would make a seqscan an appropriate choice.

7.2 keeps more extensive stats and is more able to deal with scenarios
where there are a few common values and lots of not-so-common values.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message john-paul delaney 2002-05-16 09:19:55 Re: data-type for image files
Previous Message sibusiso xolo 2002-05-16 01:03:08 data-type for image files