Postgres tip: fix “column smearing” and stop squinting with psql “Extended display”

Try this query:

If you have many columns in table, or long data in a column,
when you do a “select * from my_table” in psql, in the output,
the columns get broken up and smeared across the screen,
and you have to squint to read the screen.

Here’s the fix. Use extended display:

x
pset pager always

Run the query again:

select * from my_table;

and tell me life isn’t better already!

Instead of showing one row per line, psql will display one field per
line. Much more readable.

As a bonus, run

timing

and you’ll be informed how long your query took to run.

You can add all this goodness to your .psqlrc file if you want the
settings to persist across psql sessions.

I learned this yesterday in the joint LOPSA-LA and LA Postgres User Group meeting.