Re: Is it useful to record whether plans are generic or custom?

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: torikoshia(at)oss(dot)nttdata(dot)com
Cc: tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp, sunchengxi(at)highgo(dot)com, pgsql-hackers(at)postgresql(dot)org, masao(dot)fujii(at)oss(dot)nttdata(dot)com, pavel(dot)stehule(at)gmail(dot)com, legrand_legrand(at)hotmail(dot)com
Subject: Re: Is it useful to record whether plans are generic or custom?
Date: 2021-02-04 02:19:53
Message-ID: 20210204.111953.866521874345150145.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Thu, 04 Feb 2021 10:16:47 +0900, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com> wrote in
> Chengxi Sun, Yamada-san, Horiguchi-san,
>
> Thanks for all your comments.
> Adding only the number of generic plan execution seems acceptable.
>
> On Mon, Jan 25, 2021 at 2:10 PM Kyotaro Horiguchi
> <horikyota(dot)ntt(at)gmail(dot)com> wrote:
> > Note that ActivePortal is the closest nested portal. So it gives the
> > wrong result for nested portals.
>
> I may be wrong, but I thought it was ok since the closest nested
> portal is the portal to be executed.

After executing the inner-most portal, is_plan_type_generic has a
value for the inner-most portal and it won't be changed ever after. At
the ExecutorEnd of all the upper-portals see the value for the
inner-most portal left behind is_plan_type_generic nevertheless the
portals at every nest level are indenpendent.

> ActivePortal is used in ExecutorStart hook in the patch.
> And as far as I read PortalStart(), ActivePortal is changed to the
> portal to be executed before ExecutorStart().
>
> If possible, could you tell me the specific case which causes wrong
> results?

Running a plpgsql function that does PREPRE in a query that does
PREPARE?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2021-02-04 02:37:13 Re: Recording foreign key relationships for the system catalogs
Previous Message Kyotaro Horiguchi 2021-02-04 01:50:45 Re: Bug in COPY FROM backslash escaping multi-byte chars