longqueries.py
changeset 39 0cef3540b69f
parent 27 5fb4883604d6
child 44 4fe39c59c515
equal deleted inserted replaced
38:d3593869d624 39:0cef3540b69f
    10         self.init()
    10         self.init()
    11 
    11 
    12     def main(self):
    12     def main(self):
    13         stats = pgstats.PgStats(self.pgm.get_conn('target'))
    13         stats = pgstats.PgStats(self.pgm.get_conn('target'))
    14 
    14 
    15         for ln in stats.list_long_queries('0m'):
    15         for ln in stats.list_long_queries('1m'):
    16             print(highlight(1), 'backend PID: ', ln['procpid'], ', query_start: ', ln['query_start'].strftime('%F %T'), highlight(0), sep='')
    16             print(highlight(1), 'backend PID: ', ln['procpid'], ', query_start: ', ln['query_start'].strftime('%F %T'), highlight(0), sep='')
    17             print(ln['query'])
    17             print(ln['query'])
    18             print()
    18             print()
    19 
    19 
    20 
    20