longqueries.py
changeset 27 5fb4883604d6
parent 9 2fcc8ef0b97d
child 39 0cef3540b69f
--- a/longqueries.py	Fri Jan 13 15:49:24 2012 +0100
+++ b/longqueries.py	Tue Feb 07 10:40:35 2012 +0100
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3.2
 
 from pgtoolkit import pgstats, toolbase
+from pgtoolkit.highlight import highlight
 
 
 class LongQueriesTool(toolbase.SimpleTool):
@@ -11,9 +12,9 @@
     def main(self):
         stats = pgstats.PgStats(self.pgm.get_conn('target'))
 
-        for ln in stats.list_long_queries():
+        for ln in stats.list_long_queries('0m'):
+            print(highlight(1), 'backend PID: ', ln['procpid'], ', query_start: ', ln['query_start'].strftime('%F %T'), highlight(0), sep='')
             print(ln['query'])
-            print('   ', 'query_start:', ln['query_start'].strftime('%F %T'))
             print()