Jeffrey Melloy <jmelloy(at)visualdistortion(dot)org> writes:
> The other day I was playiing around with a query, and randomly changed
> a few things. I noticed a 10 times speedup and didn't know why. Both
> queries return identical results.
It looks like the planner's overestimate of the number of rows returned
by the function causes it to insert a Materialize step in the inside of
the nestloop join, so as to avoid recomputing the inner scan multiple
times. Which is a good idea. I wonder why it didn't do it in both
cases?
regards, tom lane