


Some usefull sql commands syntax - comment to end of line /* C-like comment, possibly Running a SQL script (command line) psql -f script.sql databaseName # Example on dumping & restoring postgresql database # Don't forget to 'CREATE DATABASE newdb ' Pg_dump and pg_restore pair pg_dump therrr-dev > dump.sql ‘products’: select * from pg_indexes where tablename = 'products' Dumping postgres database \di - List all indexes for current schemaĪlso, listing indexes for desired table, e.g. Opening PostgreSQL console: psql -h -U ĭbname is optional Working with pgsql console \? - Help

For more detailed cheat sheets there are a plenty good links at the bottom of this post.
#POSTGRESQL CHEAT SHEET PDF#
Download PostgreSQL cheat sheet We provide you with a 3-page PostgreSQL cheat sheet in PDF format. And I guess they are useful when you have an experience writing SQL queries and want to know database-specific things. The PostgreSQL cheat sheet provides you with the common PostgreSQL commands and statements that enable you to work with PostgreSQL quickly and effectively. create new user Joe and new DB (login to postgres using CREATE USER davide WITH PASSWORD jw8s0F4 CREATE. It is not detailed at all and contains a few commands. PostgreSQL Cheatsheet if initial setup 1. So, here is a cheat sheet for working with PostgreSQL. A best way of doing this is to write an article or, in my case, yet another cheat sheet. A time has come and I need to work with PostgreSQL databases and as it always happens - some things concerning with this work need to be remembered.
