Skip to content

Instantly share code, notes, and snippets.

@vincent178
Last active August 29, 2015 14:01
Show Gist options
  • Save vincent178/4897cc440658880eeda2 to your computer and use it in GitHub Desktop.
Save vincent178/4897cc440658880eeda2 to your computer and use it in GitHub Desktop.
postgresql admin commands

find the largest table in the postgreSQL database

SELECT relname, relpages FROM pg_class ORDER BY relpages DESC LIMIT toprungsjobs_backup=> SELECT relname, relpages FROM pg_class ORDER BY relpages DESC LIMIT 5;

find size of the postgreSQL table

SELECT pg_size_pretty(pg_relation_size('pg_attribute'));

view the indexes of an existing postgreSQL table

# \d table_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment