Skip to content

Instantly share code, notes, and snippets.

Avatar

Tyler Pearson tylerpearson

View GitHub Profile
View skew.sql
SELECT SCHEMA schemaname,
"table" tablename,
table_id tableid,
size size_in_mb,
CASE
WHEN diststyle NOT IN ('EVEN','ALL') THEN 1
ELSE 0
END has_dist_key,
CASE
WHEN sortkey1 IS NOT NULL THEN 1
View redshift-vacuuming.sql
SELECT trim(pgdb.datname) AS Database,
trim(a.name) AS Table, ((b.mbytes/part.total::decimal)*100)::decimal(5,2) AS pct_of_total, b.mbytes, b.unsorted_mbytes
FROM stv_tbl_perm a
JOIN pg_database AS pgdb ON pgdb.oid = a.db_id
JOIN (SELECT tbl, sum(decode(unsorted, 1, 1, 0)) AS unsorted_mbytes, count(*) AS mbytes
FROM stv_blocklist GROUP BY tbl) b ON a.id=b.tbl
JOIN ( SELECT sum(capacity) AS total
FROM stv_partitions WHERE part_begin=0 ) AS part ON 1=1
WHERE a.slice=0
ORDER BY 3 desc, db_id, name;
@tylerpearson
tylerpearson / redshift-table-sizes.sql
Created Mar 14, 2017
sizes of tables in redshift
View redshift-table-sizes.sql
SELECT TRIM(pgdb.datname) AS Database,
TRIM(a.name) AS Table,
((b.mbytes/part.total::decimal)*100)::decimal(5,2) AS pct_of_total,
b.mbytes,
b.unsorted_mbytes
FROM stv_tbl_perm a
JOIN pg_database AS pgdb
ON pgdb.oid = a.db_id
JOIN ( SELECT tbl,
SUM( DECODE(unsorted, 1, 1, 0)) AS unsorted_mbytes,
@tylerpearson
tylerpearson / sidekiq
Created Aug 18, 2016
restart rsyslog with logrotate on ubuntu. Even with copytruncate, rsyslog needed a restart to get the latest in the log
View sidekiq
/var/www/site/shared/log/sidekiq.log {
missingok
daily
rotate 7
compress
delaycompress
notifempty
copytruncate
postrotate
sudo /etc/init.d/rsyslog restart
View wv-2016.md
Bill # WV bill name ALEC Bill Name Similarity
sb407 Increasing high-quality educational opportunities in public school system Public Charter School Authorizing and Accountability Act 14
hb4011 Providing for the authorization and oversight of public charter schools Public Charter School Authorizing and Accountability Act 14
hb4449 Creating the Compact for a Balanced Budget Compact for America: Balanced Budget Amendment 15
hb4030 Updating the meaning of federal adjusted gross income and certain other terms used in the West Vi
View 2013-wv-alec-results.md
Bill # WV bill name ALEC Bill Name Similarity
hb2092 Adding certain sanctions for violations of probation and parole Swift and Certain Sanctions Act 7
sb629 Limiting liability of landowners, operators and contractors in water pollution abatement projects The Environmental Good Samaritan Act 13
hb2080 Requiring community corrections performance measurement standards for agencies responsible for supervising individuals placed on probation, serving a period of parole Community Corrections Performance Measurement Act 13
hb3044
View 2012-wv-alec-results.md
Bill # WV bill name ALEC Bill Name Similarity
hb3260 Adding certain sanctions for violations of probation and parole Swift and Certain Sanctions Act 6
hb2324 Special Needs Scholarship Program The Special Needs Scholarship Program Act 13
hb3051 The Parent Empowerment and Choice Act Parent Trigger Act 14
hb3206 Implementing evidence-based practices to reduce recidivism Recidivism Reduction Act 15
hb3212 Requ
View 2014-wv-alec-similarity.md
Bill # WV bill name ALEC Bill Name Similarity
hb4316 Creating the student data accessability, transparency and accountability act Student Data Accessibility, Transparency, and Accountability Act 9
sb68 Limiting liability of participants in certain water pollution abatement projects The Environmental Good Samaritan Act 13
sb579 Creating Land Reuse Agency Authorization Act Alternative Method of Court Appearances Act 19
hb4619 Authorizing innovation school districts The Innovation Schools and School Districts Act 20
[sb503](htt
View 2015-wv-alec-results.md
Bill # WV bill name ALEC Bill Name Similarity
hb2729 Relating to welfare system integrity Welfare System Integrity Act 7
sb411 Creating Asbestos Bankruptcy Trust Claims Transparency Act and Asbestos and Silica Claims Priorities Act Asbestos and Silica Claims Priorities Act 10
sb14 Creating Public Charter Schools Act of 2015 Public Charter School Funding and Facilities Model Legislation 14
hb2712 Relating to employment and privacy protection Employee Online Privacy Act 14
[hb2014](http://www.legis.state.wv.us/Bill_Status/bil
View 2012-wv-alec-results.md
Bill # WV bill name ALEC Bill Name Similarity
hb3260 Adding certain sanctions for violations of probation and parole Swift and Certain Sanctions Act 6
hb2324 Special Needs Scholarship Program The Special Needs Scholarship Program Act 13
hb3051 The Parent Empowerment and Choice Act Parent Trigger Act 14
hb3206 Implementing evidence-based practices to reduce recidivism Recidivism Reduction Act 15
hb3212 Requ
You can’t perform that action at this time.