Luis Amigo <lamigo@atc.unican.es> writes:
> if we use set enable_nestloop=off the result is:
> Limit (cost=100160926.76..100160926.76 rows=100 width=120)
> -> Sort (cost=100160926.76..100160926.76 rows=100 width=120)
> -> Nested Loop (cost=100160637.42..100160923.43 rows=100
> width=120)
It's choosing a nestloop at the top level despite the large penalty
added to the cost, presumably because it cannot find any other way to
do the top-level join. You won't get any more useful answer than that
as long as you're not showing us the query and table schemas involved...
regards, tom lane