Search Postgresql Archives

Re: Slight change in query leads to unexpected change in query plan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jack Orenstein <jack.orenstein@xxxxxxx> 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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux