Skip to content

Instantly share code, notes, and snippets.

@shanev
Last active July 17, 2020 15:16
Show Gist options
  • Save shanev/7b1c27e68584789f423c64ad402f22ba to your computer and use it in GitHub Desktop.
Save shanev/7b1c27e68584789f423c64ad402f22ba to your computer and use it in GitHub Desktop.

Postgres Cheat Sheet

psql -h localhost -U postgres -d [db_name]

Disable word wrap PAGER="less -S" psql -h localhost -U postgres -d [db_name]

Connection

Show connection info \conninfo

Schema

List tables \dt

Fields \d+ [table]

Queries

select * from [table];

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