
Show IP of the DB Instance: SELECT inet_server_addr().$ echo "bind "^R " em-inc-search-prev " > $HOME/.editrc Get all indexes from all tables of a schema:.SELECT * FROM pg_indexes WHERE tablename='_table_name_' AND schemaname='_schema_name_' : Show table indexes.show statement_timeout : Show current user's statement timeout.

#Postgresql cheat sheet how to#
#Postgresql cheat sheet password#
create role _test2_ noinherit login password _passsword_ : Create a role with username and password.create role _test1_: Create a role with an existing username.\du _username_: List a username if present.\! _bash_command_: execute _bash_command_ (e.g.\copy (SELECT * FROM _table_name_) TO 'file_path_and_name.csv' WITH CSV: Export a table as CSV.\x: Pretty-format query results instead of the not-so-useful ASCII tables.\df+ _function_ : Show function SQL code.

\dt *.*: List tables from all schemas (if *.* is omitted will only show SEARCH_PATH ones).\d+ _table_: More detailed table definition including description and physical disk size.\d _table_: Show table definition (columns, etc.) including triggers.\?: Show help (list of available commands with an explanation).Most \d commands support additional param of _schema_.name_ and accept wildcards like *.* -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS).-E: will describe the underlaying queries of the \ commands (cool for learning!).Some interesting flags (to see all, use -h or -help depending on your psql version):
