Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ SUBDIRS = \
pg_overexplain \
pg_plan_advice \
pg_prewarm \
pg_session_buffer_usage \
pg_stat_statements \
pg_surgery \
pg_trgm \
Expand Down
22 changes: 3 additions & 19 deletions contrib/auto_explain/auto_explain.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,9 @@ explain_ExecutorStart(QueryDesc *queryDesc, int eflags)

if (auto_explain_enabled())
{
/*
* Set up to track total elapsed time in ExecutorRun. Make sure the
* space is allocated in the per-query context so it will go away at
* ExecutorEnd.
*/
/* Set up to track total elapsed time in ExecutorRun. */
if (queryDesc->totaltime == NULL)
{
MemoryContext oldcxt;

oldcxt = MemoryContextSwitchTo(queryDesc->estate->es_query_cxt);
queryDesc->totaltime = InstrAlloc(1, INSTRUMENT_ALL, false);
MemoryContextSwitchTo(oldcxt);
}
queryDesc->totaltime = InstrQueryAlloc(INSTRUMENT_ALL);
}
}

Expand Down Expand Up @@ -381,14 +371,8 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
*/
oldcxt = MemoryContextSwitchTo(queryDesc->estate->es_query_cxt);

/*
* Make sure stats accumulation is done. (Note: it's okay if several
* levels of hook all do this.)
*/
InstrEndLoop(queryDesc->totaltime);

/* Log plan if duration is exceeded. */
msec = INSTR_TIME_GET_MILLISEC(queryDesc->totaltime->total);
msec = INSTR_TIME_GET_MILLISEC(queryDesc->totaltime->instr.total);
if (msec >= auto_explain_log_min_duration)
{
ExplainState *es = NewExplainState();
Expand Down
1 change: 1 addition & 0 deletions contrib/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ subdir('pg_overexplain')
subdir('pg_plan_advice')
subdir('pg_prewarm')
subdir('pgrowlocks')
subdir('pg_session_buffer_usage')
subdir('pg_stat_statements')
subdir('pgstattuple')
subdir('pg_surgery')
Expand Down
23 changes: 23 additions & 0 deletions contrib/pg_session_buffer_usage/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# contrib/pg_session_buffer_usage/Makefile

MODULE_big = pg_session_buffer_usage
OBJS = \
$(WIN32RES) \
pg_session_buffer_usage.o

EXTENSION = pg_session_buffer_usage
DATA = pg_session_buffer_usage--1.0.sql
PGFILEDESC = "pg_session_buffer_usage - show buffer usage statistics for the current session"

REGRESS = pg_session_buffer_usage

ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_session_buffer_usage
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
Loading