Skip to main content

Three useful psql settings

  • By default psql doesn't display NULLs, but you can configure it to show NULLs as a printable character or string e.g: \pset null '█' or \pset null '(null)'. This makes it is easier to distinguish NULL from empty string.
  • \timing on appends an execution time to each result e.g: Time: 0.412 ms. \timing off turns it off.
  • By default, psql stores every line in history. Setting \set HISTCONTROL ignoredups ignores lines which match the previous history line. This is a common default for shells and REPLs.

These can be used on an ad-hoc basis or added to .psqlrc.