postgres-github.git / summary / log / commit / refs

commit    2c16deee2f7d52d6567dcbad046f74a8e880ee52
Author:   Andres Freund <andres@anarazel.de>
Date:     Wed Apr 08 04:02:26 2026 +0000

    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

[parent: db93032a7cbd]