Skip to main content
0 reactions

How to Show a Setting with SHOW in PostgreSQL

Featured card for How to Show a Setting with SHOW in PostgreSQL, with a terminal showing SHOW TimeZone returning Asia/Kolkata and SHOW work_mem returning 4MB.
How to Show a Setting with SHOW in PostgreSQL

SHOW displays the current value of a PostgreSQL setting, such as the time zone or the server’s version. Type SHOW and the setting’s name in psql. Here’s how, with three settings as the example.

Every command and output on this page is real, from PostgreSQL 19 on macOS.

Syntax

SyntaxSQL
SHOW setting_name;
SHOW ALL;
  • setting_name: the setting to show, such as TimeZone. Setting names don’t care about upper and lower case.
  • SHOW ALL: shows every setting, with a short description of each.

See SHOW (opens in a new tab) in the PostgreSQL documentation.

The Example

No database or table needed: you ask the server about three of its settings.

Step 1: Connect

Open Terminal and connect to your PostgreSQL server with psql as the postgres user:

TerminalBash
psql -U postgres

Type the user’s password when psql asks for it. psql connects you to the postgres database, and its prompt is postgres=#.

Step 2: Show the Time Zone

postgres=#SQL
SHOW TimeZone;
OutputPlain text
   TimeZone
--------------
 Asia/Kolkata
(1 row)

This server works in India’s time zone. Yours shows its own.

Step 3: Show Two More Settings

postgres=#SQL
SHOW work_mem;
OutputPlain text
 work_mem
----------
 4MB
(1 row)

work_mem is the memory one sort or hash may use before it writes to temporary files on disk. 4MB is the default.

postgres=#SQL
SHOW server_version;
OutputPlain text
 server_version
----------------
 19.0
(1 row)

server_version is the version of PostgreSQL the server runs.

Common Mistakes

MistakeWhat happensDo this instead
A misspelled setting nameERROR: unrecognized configuration parameter "timezon"Check the spelling. SHOW ALL lists every setting’s name.

FAQ

How do I change a setting?

SET changes many settings for your current session. SHOW only reads them.

Conclusion

SHOW and a setting’s name display its current value, and SHOW ALL lists them all.

Additional Resources

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.

0 comments