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

Commitf0d6f20

Browse files
committed
Keep pg_stat_statements' query texts in a file, not in shared memory.
This change allows us to eliminate the previous limit on stored querylength, and it makes the shared-memory hash table very much smaller,allowing more statements to be tracked. (The default value ofpg_stat_statements.max is therefore increased from 1000 to 5000.)In typical scenarios, the hash table can be large enough to hold all thestatements commonly issued by an application, so that there is little"churn" in the set of tracked statements, and thus little need to do I/Oto the file.To further reduce the need for I/O to the query-texts file, add a wayto retrieve all the columns of the pg_stat_statements view except forthe query text column. This is probably not of much interest for humanuse but it could be exploited by programs, which will prefer using thequeryid anyway.Ordinarily, we'd need to bump the extension version number for the latterchange. But since we already advanced pg_stat_statements' version numberfrom 1.1 to 1.2 in the 9.4 development cycle, it seems all right to justredefine what 1.2 means.Peter Geoghegan, reviewed by Pavel Stehule
1 parentea9df81 commitf0d6f20

File tree

4 files changed

+929
-191
lines changed

4 files changed

+929
-191
lines changed

‎contrib/pg_stat_statements/pg_stat_statements--1.1--1.2.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DROP VIEW pg_stat_statements;
1212
DROPFUNCTION pg_stat_statements();
1313

1414
/* Now redefine*/
15-
CREATEFUNCTIONpg_stat_statements(
15+
CREATEFUNCTIONpg_stat_statements(IN showtextboolean,
1616
OUT useridoid,
1717
OUT dbidoid,
1818
OUT queryidbigint,
@@ -34,10 +34,10 @@ CREATE FUNCTION pg_stat_statements(
3434
OUT blk_write_time float8
3535
)
3636
RETURNS SETOF record
37-
AS'MODULE_PATHNAME'
38-
LANGUAGE C;
37+
AS'MODULE_PATHNAME','pg_stat_statements_1_2'
38+
LANGUAGE C STRICT VOLATILE;
3939

4040
CREATEVIEWpg_stat_statementsAS
41-
SELECT*FROM pg_stat_statements();
41+
SELECT*FROM pg_stat_statements(true);
4242

4343
GRANTSELECTON pg_stat_statements TO PUBLIC;

‎contrib/pg_stat_statements/pg_stat_statements--1.2.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RETURNS void
99
AS'MODULE_PATHNAME'
1010
LANGUAGE C;
1111

12-
CREATEFUNCTIONpg_stat_statements(
12+
CREATEFUNCTIONpg_stat_statements(IN showtextboolean,
1313
OUT useridoid,
1414
OUT dbidoid,
1515
OUT queryidbigint,
@@ -31,12 +31,12 @@ CREATE FUNCTION pg_stat_statements(
3131
OUT blk_write_time float8
3232
)
3333
RETURNS SETOF record
34-
AS'MODULE_PATHNAME'
35-
LANGUAGE C;
34+
AS'MODULE_PATHNAME','pg_stat_statements_1_2'
35+
LANGUAGE C STRICT VOLATILE;
3636

3737
-- Register a view on the function for ease of use.
3838
CREATEVIEWpg_stat_statementsAS
39-
SELECT*FROM pg_stat_statements();
39+
SELECT*FROM pg_stat_statements(true);
4040

4141
GRANTSELECTON pg_stat_statements TO PUBLIC;
4242

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp