Skip to main content


brew info postgresql

Learn Postgres at the Playground - -

Postgres WASM -

Storage engine for modern hardware - - From Thoughworks Technology Radar 27:

OrioleDB is a new storage engine for PostgreSQL. Our teams use PostgreSQL a lot, but its storage engine was originally designed for hard drives. Although there are several options to tune for modern hardware, it can be difficult and cumbersome to achieve optimal results. OrioleDB addresses these challenges by implementing a cloud-native storage engine with explicit support for solid-state drives (SSDs) and nonvolatile random-access memory (NVRAM)...

Reserved words

Error codes


With Brew:

brew services start postgresql
brew services stop postgresql
brew services restart postgresql
brew services list

With pg_ctl:

pg_ctl -D /usr/local/var/postgres start
pg_ctl -D /usr/local/var/postgres stop


postgres --help

Version: postgres --version or postgres -V

Check if Postgres is running: pgrep -l postgres. If there's no output it's not running.

Check the logs:

Create database: createdb dbname

Delete database: dropdb dbname

Recreate/reset database: dropdb dbname && createdb dbname

Copy database:


Command reference:

Start and connect to a db: psql dbname

Connect with a specific user instead of the default: psql -d dbname -U username

Print current user: \conninfo - see

List users: \du

Quit: \q

Connect to a db: \c dbname or \connect dbname. We can specify username, host, port etc.

Load .sql file: \i src/database-setup.sql

List databases: \l

List the relations (tables) of your currently connected database: \d

List tables (relations): \dt

List tables and indexes: \dti

Show table schema: \d tablename



pg_ctl -D /usr/local/var/postgres start
pg_ctl -D /usr/local/var/postgres stop

Upgrade to new version

Eg from 13 to 14.

As explained in brew info postgresql you can do brew postgresql-upgrade-database.



At the home, click 'Add New Server', then fill the dialog with this data:

  • General tab
    • Name: Servidor Local
  • Connection tab
    • Host name/address: localhost
    • Port: 5432
    • Username: albertvilacalvo