Skip to content

Instantly share code, notes, and snippets.

WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@msherry
msherry / balanced.yml
Created June 17, 2014 22:10
Working tmuxinator
# ~/.tmuxinator/balanced.yml
name: balanced
root: ~/pp/balanced
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
# ~/.tmuxinator/balanced.yml
name: balanced
root: ~/pp/balanced
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
@msherry
msherry / coverage.py
Created January 8, 2014 23:41
Coverage enforcement
#!/usr/bin/env python
'''
Jenkins' Cobertura plugin doesn't allow marking a build as successful or
failed based on coverage of individual packages -- only the project as a
whole. This script will parse the coverage.xml file and fail if the coverage of
specified packages doesn't meet the thresholds given
'''
def fmt_currency(val):
return '%.02f' % (val/100.)