Support server and database statistics on Greenplum. Fixes #3004

This commit is contained in:
Joao Pedro De Almeida Pereira 2018-01-12 10:02:46 +00:00 committed by Dave Page
parent c32eb6bd37
commit ed3e374df6
2 changed files with 2 additions and 13 deletions

View File

@ -10,16 +10,9 @@ SELECT
tup_inserted AS {{ conn|qtIdent(_('Tuples inserted')) }},
tup_updated AS {{ conn|qtIdent(_('Tuples updated')) }},
tup_deleted AS {{ conn|qtIdent(_('Tuples deleted')) }},
stats_reset AS {{ conn|qtIdent(_('Last statistics reset')) }},
slave.confl_tablespace AS {{ conn|qtIdent(_('Tablespace conflicts')) }},
slave.confl_lock AS {{ conn|qtIdent(_('Lock conflicts')) }},
slave.confl_snapshot AS {{ conn|qtIdent(_('Snapshot conflicts')) }},
slave.confl_bufferpin AS {{ conn|qtIdent(_('Bufferpin conflicts')) }},
slave.confl_deadlock AS {{ conn|qtIdent(_('Deadlock conflicts')) }},
pg_database_size(db.datid) AS {{ conn|qtIdent(_('Size')) }}
FROM
pg_stat_database db
LEFT JOIN pg_stat_database_conflicts slave ON db.datid=slave.datid
WHERE {% if did %}
db.datid = {{ did|qtLiteral }}::OID{% else %}
db.datid > {{ last_system_oid|qtLiteral }}::OID

View File

@ -4,8 +4,6 @@ SELECT
datname AS {{ conn|qtIdent(_('Database')) }},
backend_start AS {{ conn|qtIdent(_('Backend start')) }},
CASE
WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
client_hostname || ':' || client_port
WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
client_addr::text || ':' || client_port
WHEN client_port = -1 THEN
@ -26,11 +24,9 @@ UNION
SELECT
procpid AS "PID",
usename AS {{ conn|qtIdent(_('User')) }},
datname AS {{ conn|qtIdent(_('Database')) }},
'' AS {{ conn|qtIdent(_('Database')) }},
backend_start AS {{ conn|qtIdent(_('Backend start')) }},
CASE
WHEN client_hostname IS NOT NULL AND client_hostname != '' THEN
client_hostname || ':' || client_port
WHEN client_addr IS NOT NULL AND client_addr::text != '' THEN
client_addr::text || ':' || client_port
WHEN client_port = -1 THEN
@ -38,7 +34,7 @@ SELECT
ELSE
'localhost:' || client_port
END AS {{ conn|qtIdent(_('Client')) }},
{{ _('Streaming Replication') }}|qtLiteral AS {{ conn|qtIdent(_('Application')) }},
{{ _('Streaming Replication')|qtLiteral }} AS {{ conn|qtIdent(_('Application')) }},
null AS {{ conn|qtIdent(_('Waiting?')) }},
state || ' [sync (state: ' || COALESCE(sync_state, '') || ', priority: ' || sync_priority::text || ')] (' || sent_location || ' sent, ' || write_location || ' written, ' || flush_location || ' flushed, ' || replay_location || ' applied)' AS {{ conn|qtIdent(_('Query')) }},
null AS {{ conn|qtIdent(_('Query start')) }},