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