Re: Check each of base restriction clauses for constant-FALSE-or-NULL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Check each of base restriction clauses for constant-FALSE-or-NULL
Date: 2023-10-10 18:24:08
Message-ID: 430976.1696962248@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Also, if you compare that test case to the one immediately following
> it, it's downright weird that we are presently smarter about
> optimizing the more complicated case. (I've not dug into exactly
> why that is; maybe worth running it to ground?)

The reason seems to be that joinrels.c's restriction_is_constant_false
knows that it has to check all members of the restrictinfo list, not
just one; and we get to that because some of the originally generated
EC clauses are join clauses in the second case.

So this logic in relation_excluded_by_constraints is just wrong ---
premature optimization on my part, looks like.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-10-10 18:29:23 Re: Suggestion. Optional local ORDER BY clause for DISTINCT ON
Previous Message Tom Lane 2023-10-10 17:56:16 Re: Check each of base restriction clauses for constant-FALSE-or-NULL