Jack Orenstein <jack(dot)orenstein(at)hds(dot)com> writes:
> Limit (cost=0.00..324.99 rows=100 width=451)
> -> Index Scan using t_pkey on t (cost=0.00..296027.98 rows=91088 width=451)
> Index Cond: (pk > 1000000000)
> Adding the value restriction at the top of this query plan wouldn't increase the
> cost very much.
You're missing the point: with the value restriction in place, it's
estimating that it will probably have to scan all 91000 rows (because
there are fewer than 100 satisfying the value restriction). And that
is going to cost somewhere north of 296027 cost units --- the cost
shown, plus 91000 invocations of the value-restriction check.
Which is considerably more than the cost of the other plan.
regards, tom lane