3), 2), 1).
The planner needs the right information to make the right decision.
However, the planner rarely has perfect information, so the algorithms
need to be able to cope with some amount of imperfection while still
generally making the right decision. There are also a limited
(relatively
I gather that a big part of making queries performant is making sure the
planner's estimates reflect reality.
Given a random explain analyze line:
Limit (cost=0.02..943.11 rows=50 width=16) (actual time=0.603..79.729
rows=50 loops=1)
which is the truer statement?
1. As long as costs go up