-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the xmin horizon to running query display
The xmin horizon was added in 9.4 in commit [1]. [1] postgres/postgres@dd1a3bc
- Loading branch information
Showing
26 changed files
with
166 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ show_instance = no | |
show_system = no | ||
show_workers = no | ||
|
||
[xmin] | ||
hidden = yes | ||
|
||
[database] | ||
hidden = yes | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[xmin] | ||
hidden = yes | ||
|
||
[database] | ||
hidden = yes | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[xmin] | ||
hidden = no | ||
|
||
[database] | ||
hidden = no | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- Get data from pg_activity from pg 9.4 to 9.6 | ||
-- NEW pg_stat_activity.backend_xmin | ||
SELECT | ||
a.pid AS pid, | ||
a.backend_xmin AS xmin, | ||
a.application_name AS application_name, | ||
a.datname AS database, | ||
a.client_addr AS client, | ||
EXTRACT(epoch FROM (NOW() - a.{duration_column})) AS duration, | ||
a.wait_event AS wait, | ||
a.usename AS user, | ||
a.state AS state, | ||
a.query AS query, | ||
pg_catalog.pg_encoding_to_char(b.encoding) AS encoding, | ||
NULL AS query_leader_pid, | ||
false AS is_parallel_worker | ||
FROM | ||
pg_stat_activity a | ||
LEFT OUTER JOIN pg_database b ON a.datid = b.oid | ||
WHERE | ||
state <> 'idle' | ||
AND pid <> pg_backend_pid() | ||
AND CASE WHEN {min_duration} = 0 | ||
THEN true | ||
ELSE extract(epoch from now() - {duration_column}) > %(min_duration)s | ||
END | ||
AND CASE WHEN {dbname_filter} IS NULL THEN true | ||
ELSE a.datname ~* %(dbname_filter)s | ||
END | ||
ORDER BY | ||
EXTRACT(epoch FROM (NOW() - a.{duration_column})) DESC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.