Re: Evaluate expression at planning time for two more cases - Mailing list pgsql-hackers

From Surafel Temesgen
Subject Re: Evaluate expression at planning time for two more cases
Date
Msg-id CALAY4q_UWJyrP-y=g7-uBBF_O8PJ5jwQNrHqeOcbDMNpJ9wY1Q@mail.gmail.com
Whole thread Raw
In response to Re: Evaluate expression at planning time for two more cases  (Surafel Temesgen <surafel3000@gmail.com>)
Responses Re: Evaluate expression at planning time for two more cases
Re: Evaluate expression at planning time for two more cases
List pgsql-hackers


On Tue, Sep 8, 2020 at 12:59 PM Surafel Temesgen <surafel3000@gmail.com> wrote:
Hi Tom

On Tue, Sep 8, 2020 at 4:46 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
The "check_null_side" code you're proposing seems really horrid.
For one thing, it seems quite out of place for eval_const_expressions
to be doing that.  For another, it's wrong in principle because
eval_const_expressions doesn't know which part of the query tree
it's being invoked on, so it cannot know whether outer-join
nullability is an issue.  For another, doing that work over again
from scratch every time we see a potentially optimizable NullTest
looks expensive.  (I wonder whether you have tried to measure the
performance penalty imposed by this patch in cases where it fails
to make any proof.)


I was thinking about collecting data about joins only once at the start of eval_const_expressions but I assume most queries don't have NULL check expressions and postpone it until we find one. Thinking about it again I think it can be done better by storing check_null_side_state into eval_const_expressions_context to use it for subsequent evaluation.  


Attached patch does like the above and includes NOT NULL constraint column.

regards

Surafel  

Attachment

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: PATCH: Attempt to make dbsize a bit more consistent
Next
From: "Andrey V. Lepikhov"
Date:
Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions