Re: Is it useful to record whether plans are generic or custom?
torikoshia <torikoshia@oss.nttdata.com>
From: torikoshia <torikoshia@oss.nttdata.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: ikedamsh@oss.nttdata.com, atorik@gmail.com,
pgsql-hackers@postgresql.org, masao.fujii@oss.nttdata.com,
legrand_legrand@hotmail.com, tatsuro.yamada.tf@nttcom.co.jp
Date: 2020-06-11T05:59:22Z
Lists: pgsql-hackers
Attachments
- 0005-Expose-counters-of-plancache-to-pg_prepared_statement.patch (text/x-diff) patch 0005
On 2020-06-10 18:00, Kyotaro Horiguchi wrote:
>
> + TupleDescInitEntry(tupdesc, (AttrNumber) 8, "last_plan",
>
> This could be a problem if we showed the last plan in this view. I
> think "last_plan_type" would be better.
>
> + if (prep_stmt->plansource->last_plan_type ==
> PLAN_CACHE_TYPE_CUSTOM)
> + values[7] = CStringGetTextDatum("custom");
> + else if (prep_stmt->plansource->last_plan_type ==
> PLAN_CACHE_TYPE_GENERIC)
> + values[7] = CStringGetTextDatum("generic");
> + else
> + nulls[7] = true;
>
> Using swith-case prevents future additional type (if any) from being
> unhandled. I think we are recommending that as a convension.
Thanks for your reviewing!
I've attached a patch that reflects your comments.
Regards,
--
Atsushi Torikoshi
Commits
-
Add generic_plans and custom_plans fields into pg_prepared_statements.
- d05b172a760e 14.0 landed