Skip to content

Instantly share code, notes, and snippets.

@outworlder
Created December 22, 2011 19:11
Show Gist options
  • Save outworlder/1511462 to your computer and use it in GitHub Desktop.
Save outworlder/1511462 to your computer and use it in GitHub Desktop.
;;; Collect Postgresql statistics
(use postgresql)
(define connection-string (make-parameter '((host . "<ip>")
(user . "<user here>")
(dbname . "<db name here>"))))
(define conn (connect (connection-string)))
(define (get-stats)
(row-map (lambda (x)
(print x)) (query conn "select sum(xact_commit) from pg_stat_database"))
(sleep 5)
(get-stats))
(get-stats)
(disconnect conn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment