Skip to content

Instantly share code, notes, and snippets.

@spleenteo
Created August 25, 2014 10:08
Show Gist options
  • Save spleenteo/4cf9d1815a12d489d059 to your computer and use it in GitHub Desktop.
Save spleenteo/4cf9d1815a12d489d059 to your computer and use it in GitHub Desktop.

HEROKU PSQL

  heroku pg:psql --app [app-name]

WITHOUT CACHE

  SELECT schemaname,relname,n_live_tup
  FROM pg_stat_user_tables
  ORDER BY n_live_tup DESC

WITH CACHE

  SELECT
    nspname AS schemaname,relname,reltuples
  FROM pg_class C
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
  WHERE
    nspname NOT IN ('pg_catalog', 'information_schema') AND
    relkind='r'
  ORDER BY reltuples DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment