What Is a GUC Variable?

December 01, 2011

Thursday, December 1, 2011

You might have heard the term "GUC" before, especially on the Postgres email lists. It is documented as an acronym meaning "Grand Unified Configuration", but the section it references doesn't mention the term "GUC" at all. Pretty obscure, huh?

Our Grand Unified Configuration (GUC) system was created in 2000 as a way to control Postgres at various levels. You are probably most familiar with controlling Postgres via the postgresql.conf file or using the SQL SET command, but it is much more powerful than that.

In fact, people often get into the habit of changing variables at certain levels, and never realize that these variables can be set at more global and more local levels. Of course, some settings, like shared_buffers can only be set in postgresql.conf. (These entries are usually marked with the file comment "(change requires restart)".) But other settings, like work_mem and search_path, can be set at many levels. This email gives a very concise description:


The closest thing to global variables are GUC settings. These can be set globally in postgresql.conf, per user and/or per-database via ALTER ROLE/DATABASE ... [IN DATABASE ...], per session with SET, per function via CREATE FUNCTION ... SET and finally per subtransaction with SET LOCAL.


Of course, our documentation has an even more detailed explanation.

As I have said many times before, our GUC system seems limited at first, but once you realize that you can combine settings and set them at various levels, it becomes a powerful tool that can meet almost any need.

Share this

Relevant Blogs

What’s New in Postgres 15: Webinar Highlights

Recently, EDB hosted an exciting webinar entitled “What’s New in Postgres 15,” which covered the development process for the latest version of PostgreSQL, as well as new features and benefits...
January 15, 2023

More Blogs

Solving the Cloud Database Investment Mystery

Moving databases to the cloud is currently one of the most popular IT activities in enterprises around the world. According to Gartner, spending on cloud databases is outpacing on-premises...
January 15, 2023

Release Radar: PEM 9.0 UX/UD Improvements

We are pleased to announce the release of Postgres Enterprise Manager 9.0.  Combining management and monitoring in a single interface, Postgres Enterprise Manager (PEM) provides all the tools you need...
January 15, 2023