Skip to content

Instantly share code, notes, and snippets.

@autodidacticon
Last active July 25, 2016 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save autodidacticon/837383c0f5bcbd01c25a to your computer and use it in GitHub Desktop.
Save autodidacticon/837383c0f5bcbd01c25a to your computer and use it in GitHub Desktop.
Redshift cheat sheet
-- see current table locks
select s.schema, l.lock_owner_pid, s.table from svv_table_info s, stv_locks l where l.table_id = s.table_id;
-- see current queries
select * from stv_recents where status = 'Running';
-- kill process
select pg_terminate_backend(pid);
-- table size on disk
select pg_size_pretty(pg_relation_size(relid)) from pg_stat_user_tables where relname = 'table_name';
-- command line, dump table
pg_dump -h hostname -p port -d dbname -U username -s (schema only) -t tablename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment