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

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: ikedamsh(at)oss(dot)nttdata(dot)com, atorik(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, masao(dot)fujii(at)oss(dot)nttdata(dot)com, legrand_legrand(at)hotmail(dot)com, tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp
Subject: Re: Is it useful to record whether plans are generic or custom?
Date: 2020-06-11 05:59:22
Message-ID: cd1069769db5b296115c14d6ac922731@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
0005-Expose-counters-of-plancache-to-pg_prepared_statement.patch text/x-diff 12.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2020-06-11 06:42:46 Re: Collation versioning
Previous Message Dong Wook Lee 2020-06-11 05:25:37 Add tap test for --extra-float-digits option