PostgreSQL

PostgreSQL

All Your GUCs in a Row: fsync

fsync is a boolean, it defaults to on, and its context is sighup, so it can be changed with a configuration reload rather than a restart. It is also the most dangerous setting in postgresql.conf. Most of the parameters in this series, set wrong, cost you a bad plan or some wasted memory. This one, set wrong,

All Your GUCs in a Row: from_collapse_limit

Almost nobody writes the query shape this parameter governs:

1SELECT * FROM x, y, (SELECT * FROM a, b, c WHERE something) AS ss
2WHERE somethingelse;

But you produce it constantly without meaning to. Reference a view that contains a join and the view’s definition is inserted in place of the reference, leaving the

All Your GUCs in a Row: file_extend_method

file_extend_method is an escape hatch wearing the costume of a tuning knob. It exists for one purpose: to let you turn off a PostgreSQL 16 optimization on the filesystems where that optimization turned out to misbehave.

When a table grows, PostgreSQL has to extend its data file, and there are two ways to do that. posix_fallocate asks the operating

All Your GUCs in a Row: file_copy_method

file_copy_method is a two-value enum with a wildly disproportionate payoff. One of its settings makes copying a database take about the same fraction of a second whether the database is one gigabyte or one terabyte. The other is the way PostgreSQL has always done it. The enum is new in PostgreSQL 18, and the interesting value is clone.

All Your GUCs in a Row: extra_float_digits

extra_float_digits is the setting whose job changed out from under it. For most of PostgreSQL’s history it forced a choice between floating-point output that was easy to read and output that was exactly right, and you could not have both. Since PostgreSQL 12 you no longer have to choose, which is why the parameter you may remember reaching for is

All Your GUCs in a Row: external_pid_file

PostgreSQL already writes a PID file. Every time the postmaster starts, it drops postmaster.pid into the data directory and removes it on a clean shutdown. That file is the lock that stops a second postmaster from starting on the same data directory, and it carries eight lines of running-instance detail, the PID, the data directory, the start time, the port,

All Your GUCs in a Row: extension_control_path

For the whole of PostgreSQL’s history until now, an extension had to live in exactly one place. CREATE EXTENSION foo read foo.control from the compiled-in extension directory, the one pg_config --sharedir points at, and it looked nowhere else. If you wanted an extension available, its files had to be in that directory, which in practice meant installed as root into

All Your GUCs in a Row: exit_on_error

PostgreSQL sorts its problems by severity. An ERROR aborts the current statement and rolls back the transaction, but the session lives on; you issue a ROLLBACK and keep working. A FATAL ends the session, dropping that one connection while the server runs on. A PANIC takes the whole server down. In normal operation the line between “your statement failed” and

All Your GUCs in a Row: event_triggers

An event trigger fires on database events rather than row changes: on ddl_command_start, on sql_drop, on table_rewrite, and, since PostgreSQL 17, on login. They are how you audit or veto DDL, and they come with a well-known way to shoot yourself in the foot. Write a trigger on ddl_command_start whose function raises an exception, and every

All Your GUCs in a Row: event_source

event_source is a Windows parameter, which means that for most of the people reading this it does exactly nothing. If you run PostgreSQL on Linux, or on a managed service, there is no Windows Event Log for it to talk to, and this string sits at its default forever. What follows is for the Windows minority, and it comes down