Re: explain, planner and more.. - Mailing list pgsql-general

From Tom Lane
Subject Re: explain, planner and more..
Date
Msg-id 24654.997849404@sss.pgh.pa.us
Whole thread Raw
In response to explain, planner and more..  (Svenne Krap <usenet@krap.dk>)
List pgsql-general
Svenne Krap <usenet@krap.dk> writes:
> Why does the planner choose not to use numberdomain_pkey as index on
> numberdomain ?

>                   ->  Seq Scan on numberdomain nd  (cost=0.00..1.85
> rows=1 width=31)

Evidently because it thinks numberdomain only has one disk block,
and hence there's no possible savings from reading an index in addition
to that one disk block.  (If it were estimating more than one block
read then the cost estimate would be 2 or more.  1.85 implies one block
read = 1.0 cost unit, plus some per-tuple CPU effort.)

If numberdomain is indeed big enough to warrant an index search,
then you need to VACUUM it to update the planner's statistics.
The plan you are getting is based on statistics that say numberdomain
is tiny.

            regards, tom lane

pgsql-general by date:

Previous
From: Mike Withers
Date:
Subject: Re: Null Conversion
Next
From: Stephan Szabo
Date:
Subject: Re: Null Conversion