Today I Learned

Viewing large records with psql

Records that have rows with lots of data can be hard to view using the PostGres CLI (psql). There are a few formatting options you can use to help.

\pset format wrapped 

Setting the format to wrapped will wrap any columns with large amounts of data to preserve the table like view. While this helps it can still be difficult to tell where one wrapped row begins and ends.

Combining wrapped format with extended mode will display the reocrds horizontally with the columns on the left while still wrapping the columns with large datasets.

\pset format wrapped
\x on

Extended mode also has an auto setting that displays the rows in a table like view while they fit on the screen and falls back to the horizontal layout when they don’t.