At Thu, 21 May 2020 12:18:16 +0900, Fujii Masao <masao.fujii@oss.nttdata.com> wrote in > I like the idea exposing more CachedPlanSource fields in > pg_prepared_statements. I agree it's useful, e.g., for the debug > purpose. > This is why I implemented the similar feature in my extension. > Please see [1] for details.
Thanks. I'm not sure plan_cache_mode should be a part of the view. Cost numbers would look better if it is cooked a bit. Is it worth being in core?
I didn't come up with ideas about how to use them.
IMHO they might not so necessary..
=# select * from pg_prepared_statements; -[ RECORD 1 ]---+-------------------------------------------- name | p1 statement | prepare p1 as select a from t where a = $1; prepare_time | 2020-05-21 15:41:50.419578+09 parameter_types | {integer} from_sql | t calls | 7 custom_calls | 5 plan_generation | 6 generic_cost | 4.3100000000000005 custom_cost | 9.31
Perhaps plan_generation is not needed there.
+1.
Now 'calls' is sufficient and 'plan_generation' may confuse users.
BTW, considering 'calls' in pg_stat_statements is the number of times
statements were EXECUTED and 'plans' is the number of times
statements were PLANNED, how about substituting 'calls' for 'plans'?
At Tue, 19 May 2020 22:56:17 +0900, Atsushi Torikoshi <atorik@gmail.com> wrote in > Instead, I'm now considering using a static hash for prepared queries > (static HTAB *prepared_queries).
That might be complex and fragile considering nested query and SPI calls. I'm not sure, but could we use ActivePortal? ActivePortal->cplan is a CachedPlan, which can hold the generic/custom information.
Yes, I once looked for hooks which can get Portal, I couldn't find them.
And it also seems difficult getting keys for HTAB *prepared_queries
in existing executor hooks.
There may be oversights, but I'm now feeling returning to the idea
hook additions.
| Portal includes CachedPlanSource but there seem no hooks to | take Portal. | So I'm wondering it's necessary to add a hook to get Portal | or CachedPlanSource. | Are these too much change for getting plan types?