Re: BUG #17826: An assert failed in /src/backend/optimizer/util/var.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: xinwen(at)stu(dot)scu(dot)edu(dot)cn, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17826: An assert failed in /src/backend/optimizer/util/var.c
Date: 2023-03-17 03:34:14
Message-ID: 4087060.1679024054@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> I kinda also wanted to do the attached so that the logic to push or
> not to push was more centralised. I just couldn't figure out exactly
> why we don't push down pseudoconstant quals, therefore, was unable to
> document that sufficiently in the header comment in
> qual_is_pushdown_safe().

A pseudoconstant qual turns into a filtering Result node with a one-time
condition that controls whether it runs the child plan at all. You want
to put those as high in the plan tree as possible, so that they cut off
the maximum possible amount of work when the one-time condition is false.
So pushing one down into a subplan would be downright counterproductive.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message jian he 2023-03-17 06:19:24 Re: Re: BUG #17845: insert into on conflict bug .
Previous Message David Rowley 2023-03-17 03:11:39 Re: BUG #17826: An assert failed in /src/backend/optimizer/util/var.c