pgtoolkit/pgstats.py
changeset 39 0cef3540b69f
parent 9 2fcc8ef0b97d
child 44 4fe39c59c515
equal deleted inserted replaced
38:d3593869d624 39:0cef3540b69f
    42 
    42 
    43     def list_long_queries(self, longer_than='1m'):
    43     def list_long_queries(self, longer_than='1m'):
    44         return self._query('''SELECT datname, procpid, usename, current_query AS query,
    44         return self._query('''SELECT datname, procpid, usename, current_query AS query,
    45             waiting, xact_start, query_start, backend_start
    45             waiting, xact_start, query_start, backend_start
    46             FROM pg_stat_activity
    46             FROM pg_stat_activity
    47             WHERE current_query <> '<IDLE>' AND query_start < now() - interval %s;''',
    47             WHERE current_query <> '<IDLE>' AND query_start < now() - interval %s
       
    48             ORDER BY query_start;''',
    48             longer_than)
    49             longer_than)
    49 
    50