Simon Riggs <si...@2ndquadrant.com> writes:
> Limit  (cost=.... rows=20 width=175) (actual time=.... rows=20 loops=1)
>    ->  Sort  (cost=.... rows=568733 width=175) (actual time=....
> rows=20 loops=1)
>          Sort Method: top-N heapsort

> The Sort estimate shows 568733 rows, whereas the actual rows are 20.

[ shrug... ]  The estimated value is the planner's estimate of what would
happen *if you ran the node to completion*, which in practice doesn't
happen because of the LIMIT.  The actual value is, well, the actual value.
We certainly should not munge around the actual value.

We could imagine munging the reported estimates to account for the parent
LIMIT, but that would make it a lot harder to understand the planner's
"thought processes", because the reported estimates would have that much
less to do with the numbers actually used in the internal calculations.

                        regards, tom lane


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

Reply via email to