Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit17e0328

Browse files
committed
Allow pg_stat_statements to track planning statistics.
This commit makes pg_stat_statements support new GUCpg_stat_statements.track_planning. If this option is enabled,pg_stat_statements tracks the planning statistics of the statements,e.g., the number of times the statement was planned, the total timespent planning the statement, etc. This feature is useful to checkthe statements that it takes a long time to plan. Previously sincepg_stat_statements tracked only the execution statistics, we couldnot use that for the purpose.The planning and execution statistics are stored at the end ofeach phase separately. So there are not always one-to-one relationshipbetween them. For example, if the statement is successfully plannedbut fails in the execution phase, only its planning statistics are stored.This may cause the users to be able to see different pg_stat_statementsresults from the previous version. To avoid this,pg_stat_statements.track_planning needs to be disabled.This commit bumps the version of pg_stat_statements to 1.8since it changes the definition of pg_stat_statements function.Author: Julien Rouhaud, Pascal Legrand, Thomas Munro, Fujii MasaoReviewed-by: Sergei Kornilov, Tomas Vondra, Yoshikazu Imai, Haribabu Kommi, Tom LaneDiscussion:https://postgr.es/m/CAHGQGwFx_=DO-Gu-MfPW3VQ4qC7TfVdH2zHmvZfrGv6fQ3D-Tw@mail.gmail.comDiscussion:https://postgr.es/m/CAEepm=0e59Y_6Q_YXYCTHZkqOc6H2pJ54C_Xe=VFu50Aqqp_sA@mail.gmail.comDiscussion:https://postgr.es/m/DB6PR0301MB21352F6210E3B11934B0DCC790B00@DB6PR0301MB2135.eurprd03.prod.outlook.com
1 parent28cac71 commit17e0328

File tree

8 files changed

+603
-223
lines changed

8 files changed

+603
-223
lines changed

‎contrib/pg_stat_statements/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ OBJS = \
66
pg_stat_statements.o
77

88
EXTENSION = pg_stat_statements
9-
DATA = pg_stat_statements--1.4.sql pg_stat_statements--1.6--1.7.sql\
9+
DATA = pg_stat_statements--1.4.sql\
10+
pg_stat_statements--1.7--1.8.sql pg_stat_statements--1.6--1.7.sql\
1011
pg_stat_statements--1.5--1.6.sql pg_stat_statements--1.4--1.5.sql\
1112
pg_stat_statements--1.3--1.4.sql pg_stat_statements--1.2--1.3.sql\
1213
pg_stat_statements--1.1--1.2.sql pg_stat_statements--1.0--1.1.sql

‎contrib/pg_stat_statements/expected/pg_stat_statements.out

Lines changed: 152 additions & 79 deletions
Large diffs are not rendered by default.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/* contrib/pg_stat_statements/pg_stat_statements--1.7--1.8.sql*/
2+
3+
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
4+
\echo Use"ALTER EXTENSION pg_stat_statements UPDATE TO '1.8'" to load this file. \quit
5+
6+
/* First we have to remove them from the extension*/
7+
ALTER EXTENSION pg_stat_statements DROP VIEW pg_stat_statements;
8+
ALTER EXTENSION pg_stat_statements DROP FUNCTION pg_stat_statements(boolean);
9+
10+
/* Then we can drop them*/
11+
DROPVIEW pg_stat_statements;
12+
DROPFUNCTION pg_stat_statements(boolean);
13+
14+
/* Now redefine*/
15+
CREATEFUNCTIONpg_stat_statements(IN showtextboolean,
16+
OUT useridoid,
17+
OUT dbidoid,
18+
OUT queryidbigint,
19+
OUT querytext,
20+
OUT plans int8,
21+
OUT total_plan_time float8,
22+
OUT min_plan_time float8,
23+
OUT max_plan_time float8,
24+
OUT mean_plan_time float8,
25+
OUT stddev_plan_time float8,
26+
OUT calls int8,
27+
OUT total_exec_time float8,
28+
OUT min_exec_time float8,
29+
OUT max_exec_time float8,
30+
OUT mean_exec_time float8,
31+
OUT stddev_exec_time float8,
32+
OUT rows int8,
33+
OUT shared_blks_hit int8,
34+
OUT shared_blks_read int8,
35+
OUT shared_blks_dirtied int8,
36+
OUT shared_blks_written int8,
37+
OUT local_blks_hit int8,
38+
OUT local_blks_read int8,
39+
OUT local_blks_dirtied int8,
40+
OUT local_blks_written int8,
41+
OUT temp_blks_read int8,
42+
OUT temp_blks_written int8,
43+
OUT blk_read_time float8,
44+
OUT blk_write_time float8
45+
)
46+
RETURNS SETOF record
47+
AS'MODULE_PATHNAME','pg_stat_statements_1_8'
48+
LANGUAGE C STRICT VOLATILE PARALLEL SAFE;
49+
50+
CREATEVIEWpg_stat_statementsAS
51+
SELECT*FROM pg_stat_statements(true);
52+
53+
GRANTSELECTON pg_stat_statements TO PUBLIC;
54+
55+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp