pgsql: instrumentation: Allocate query level instrumentation in Executo
| От | Andres Freund |
|---|---|
| Тема | pgsql: instrumentation: Allocate query level instrumentation in Executo |
| Дата | |
| Msg-id | E1wAKEj-003Ukg-0v@gemulon.postgresql.org обсуждение исходный текст |
| Список | pgsql-committers |
instrumentation: Allocate query level instrumentation in ExecutorStart Until now extensions that wanted to measure overall query execution could create QueryDesc->totaltime, which the core executor would then start and stop. That's a bit odd and composes badly, e.g. extensions always had to use INSTRUMENT_ALL, because otherwise another extension might not get what they need. Instead this introduces a new field, QueryDesc->query_instr_options, that extensions can use to indicate whether they need query level instrumentation populated, and with which instrumentation options. Extensions should take care to only add options they need, instead of replacing the options of others. The prior name of the field, totaltime, sounded like it would only measure time, but these days the instrumentation infrastructure can track more resources. The secondary benefit is that this will make it obvious to extensions that they may not create the Instrumentation struct themselves anymore (often extensions build only against a postgres build without assertions). Adjust pg_stat_statements and auto_explain to match, and lower the requested instrumentation level for auto_explain to INSTRUMENT_TIMER, since the summary instrumentation it needs is only runtime. The reason to push this now, rather in the PG 20 cycle, is that 5a79e78501f already required extensions using query level instrumentations to adjust their code, and it seemed undesirable to require them to do so again for 20. Author: Lukas Fittl <lukas@fittl.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CAP53Pkyqsht+exJQYRsjhSWYKu+vFGHhPub7m6PmFD6Or0=p1g@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2c16deee2f7d52d6567dcbad046f74a8e880ee52 Modified Files -------------- contrib/auto_explain/auto_explain.c | 24 ++++-------------- contrib/pg_stat_statements/pg_stat_statements.c | 33 +++++++++---------------- src/backend/executor/execMain.c | 27 +++++++++++++------- src/backend/tcop/pquery.c | 3 ++- src/include/executor/execdesc.h | 6 +++-- 5 files changed, 40 insertions(+), 53 deletions(-)
В списке pgsql-committers по дате отправления: