Re: track generic and custom plans in pg_stat_statements

Поиск
Список
Период
Сортировка
От Andrei Lepikhov
Тема Re: track generic and custom plans in pg_stat_statements
Дата
Msg-id 5f775987-8a93-452d-bb3f-a1de53836406@gmail.com
обсуждение исходный текст
Ответ на track generic and custom plans in pg_stat_statements  (Sami Imseih <samimseih@gmail.com>)
Ответы Re: track generic and custom plans in pg_stat_statements
Список pgsql-hackers
On 6/30/25 13:45, Sami Imseih wrote:
> rebased patch.
> 
> Only changes to the tests due to the revert of nested query
> tracking in f85f6ab051b
Thank you for your efforts.

I would like to share a few thoughts about this patch. First, I believe 
the 'status' field could be renamed to 'mode,' as it aligns better with 
the plan_cache_mode GUC name. Additionally, why introduce an unknown 
status? I can't foresee a scenario where it would be necessary, as we 
typically encounter either a custom or a generic plan during execution.

On a more general note, currently, CachedPlanSource does not refer to a 
custom version of the plan. However, it seems reasonable to implement 
this for better tracking. By adding a CachedPlanSource::cplan link, we 
can establish a connection to the entire PlanCache entry instead of only 
CachedPlan within a queryDesc and, consequently, make it accessible from 
the executor. This would give an access to statistics on costs and the 
number of replannings.

Furthermore, this could lead to interesting opportunities for 
extensions, such as resetting auto-mode decisions and planning 
statistics based on actual execution statistics, and manipulating 
generic/custom plan switching logic.

-- 
regards, Andrei Lepikhov



В списке pgsql-hackers по дате отправления: