On 05/04/2017 06:22 PM, Andrew Dunstan wrote:
> I wrote this query:
>
> select (json_populate_record(null::mytype, myjson)).*
> from mytable;
>
>
> It turned out that this was an order of magnitude faster:
>
> with r as
> (
> select json_populate_record(null::mytype, myjson) as x
> from mytable
> )
> select (x).*
> from r;
I do not know the planner that well, but I imagined that when we remove
the optimization fence that one would be evaluated similar to if it had
been a lateral join, i.e. there would be no extra function calls in this
case after removing the fence.
Andreas