Skip to content

Instantly share code, notes, and snippets.

@aalvarado
Last active August 29, 2015 14:03
Show Gist options
  • Save aalvarado/61a82f0d3e3192b19167 to your computer and use it in GitHub Desktop.
Save aalvarado/61a82f0d3e3192b19167 to your computer and use it in GitHub Desktop.
postgresql DEVELOPMENT configuration
\pset null 'NULL'
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 100000
\timing
\set PROMPT1 '(%n@%M:%>) [%/] > '
\set PROMPT2 ''
\encoding unicode
\timing
\pset pager always
\setenv LESS '-iMSsx2 -FX'
\setenv PAGER 'less'
\pset linestyle unicode
\pset border 2
\pset format wrapped
# ubuntu and others /etc/posrgresql/9.x/main/postgresql.conf
# homebrew /usr/local/var/postgres/postgresql.conf
shared_buffers = 512MB
fsync = off # turns forced synchronization on or off
synchronous_commit = off # synchronization level;
full_page_writes = off # recover from partial page writes
checkpoint_segments = 32 # in logfile segments, min 1, 16MB each
checkpoint_timeout = 45min # range 30s-1h

These configurations make postgresql a lot faster for development but they should never be used in production unless you want to sob uncontrollably at corrupted data and having to restore your backups (you do have them?) from scratch on a weekend.

Remember to restart your server.

@aalvarado
Copy link
Author

If unsure where your postgresql.conf file is, or you need to check if settings in the config got loaded try:

show all;

$ psql
(user@[local]:5432 )[user] > show all;

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