Skip to content

Instantly share code, notes, and snippets.

@jasonayre
jasonayre / postgres_queries_and_commands.sql
Last active May 23, 2017 19:53 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show queries running > 2 minutes
SELECT now() - query_start as "runtime", usename, datname, waiting, state, query, pid
FROM pg_stat_activity
WHERE now() - query_start > '2 minutes'::interval
#!/bin/bash
redis_version=2.6.11
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.github.com/jasonayre/5506542/raw/bafca63f0ee08d19ad6f4c6ba131262e086a218c/install-redis.sh
# chmod +x install-redis.sh
# ./install-redis.sh