On Tue, 26 Nov 2013 14:51:22 -0500, Martijn van Oosterhout <kleptog@svana.org> wrote:
> The Seq Scan took 674ms and was run once (loops=1)
>
> The Materialise was run 94951 times and took, on average, 0.011ms to
> return the first row and 16ms to complete.
>
> 16.145 * 94951 = 1532983.895
OK, this is helpful. But why would Materialize run 94k times? I thought
the whole point of Materialize was to make a "virtual table" that could
speed up "parent" queries. If it has to recreate the subquery, why would
the planner choose to Materialize?