Matthew Wakeling <mnw21@cam.ac.uk> writes:
> [ snip... ]
> If we remove the limit, then the planner switches to this query plan:
> Limit (cost=156.24..156.26 rows=10 width=14)
... which still has a limit. I think you have made several cut-and-paste
errors here, because the plans you are exhibiting aren't legal for the
queries you say they are for. Nor do I see a reason that the planner
would use, eg, a Sort step for a query with no ORDER BY. Have you
perhaps been fooling with the various enable_xxx options to try to force
the planner to do what you think it should do?
regards, tom lane