Re: planner or statistical bug on 8.5 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: planner or statistical bug on 8.5
Date
Msg-id 21518.1263320508@sss.pgh.pa.us
Whole thread Raw
In response to Re: planner or statistical bug on 8.5  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> Tom made some changes for 8.5 that will result in materialization
> being used in more places, and I think we're seeing that here.  The
> planner thinks that materializing the inner side of the nestloop will
> save it from going to disk for every iteration, but that's not really
> true.  b will be fully cached anyway, but the planner doesn't know
> that.  I think we need to think about this a little more before we let
> this code out into the wild, or we'll get complaints about materialize
> nodes being inserted in places where they only slow things down...

I don't think it's a big deal.  The materialize node won't create much
of any slowdown unless its tuplestore gets big enough to spill to disk.
And at that point you're probably talking enough savings from avoided
visibility checks to make it worthwhile.

It's possible that the cost parameters in there need some fine-tuning,
but I don't think the costing model per se is wrong.  It's certainly
far less bogus than it was before.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: planner or statistical bug on 8.5
Next
From: Tom Lane
Date:
Subject: Re: NOT NULL violation and error-message