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: masao(dot)fujii(at)oss(dot)nttdata(dot)com, tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp, pavel(dot)stehule(at)gmail(dot)com, legrand_legrand(at)hotmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Is it useful to record whether plans are generic or custom?
Date: 2020-12-04 06:37:33
Message-ID: 20201204.153733.555429441402348456.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 04 Dec 2020 15:03:25 +0900, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com> wrote in
> On 2020-12-04 14:29, Fujii Masao wrote:
> > On 2020/11/30 15:24, Tatsuro Yamada wrote:
> >> Hi Torikoshi-san,
> >>
> >>> In this patch, exposing new columns is mandatory, but I think
> >>> it's better to make it optional by adding a GUC something
> >>> like 'pgss.track_general_custom_plans.
> >>> I also feel it makes the number of columns too many.
> >>> Just adding the total time may be sufficient.
> >> I think this feature is useful for DBA. So I hope that it gets
> >> committed to PG14. IMHO, many columns are Okay because DBA can
> >> select specific columns by their query.
> >> Therefore, it would be better to go with the current design.
> > But that design may waste lots of memory. No? For example, when
> > plan_cache_mode=force_custom_plan, the memory used for the columns
> > for generic plans is not used.
> >
>
> Yeah.
>
> ISTM now that creating pg_stat_statements_xxx views
> both for generic andcustom plans is better than my PoC patch.
>
> And I'm also struggling with the following.
>
> | However, I also began to wonder how effective it would be to just
> | distinguish between generic and custom plans. Custom plans can
> | include all sorts of plans. and thinking cache validation, generic
> | plans can also include various plans.
>
> | Considering this, I'm starting to feel that it would be better to
> | not just keeping whether generic or cutom but the plan itself as
> | discussed in the below thread.

FWIW, that seems to me to be like some existing extension modules,
pg_stat_plans or pg_store_plans.. The former is faster but may lose
plans, the latter doesn't lose plans but slower. I feel that we'd
beter consider simpler feature if we are intendeng it to be a part of
a contrib module,

> Yamada-san,
>
> Do you think it's effective just distinguish between generic
> and custom plans?
>
> Regards,

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-12-04 07:05:40 Re: Refactor MD5 implementations and switch to EVP for OpenSSL
Previous Message Amit Langote 2020-12-04 06:32:32 Re: Huge memory consumption on partitioned table with FKs