The Build


Always Do This #5: The Elements of postgresql.conf Style

16 February 2016

Everyone has their own style, unfortunately, on how they edit postgresql.conf. Some like to uncomment specific values and edit them at the point they appear in the default file, some like to tack overrides onto the end… and some do a mixture of those (don’t do that).

My personal preference is to leave everything in the default file commented, and include an overrides file (postgresql.local.conf). That way, I have an easy reference for what the defaults are, and minimum changes when a new version of postgresql.conf lands (you do know that checkpoint_segments is obsolete in 9.5, and you can’t specify it, right?). It’s easy for me to see what I’ve changed, since I can just consult that one included file.

I highly recommend this. But whatever you do, don’t do the “some things in the middle, some things at the end,” please. The next person to edit the file will thank you.

Dan Langille at 12:18, 16 February 2016:

I can’t find documentation on postgresql.local.conf

Xof at 12:19, 16 February 2016:

It’s just the postgresql.conf include facility:

include 'postgresql.local.conf'

Andrew Dunstan at 07:46, 17 February 2016:

I’m a big fan of the postgresql.local.conf approach.

par-t at 03:51, 26 February 2016:

Great piece of information! May I reference part of this on my blog if I post a backlink to this webpage? Thx.

frank church at 11:10, 1 March 2016:

I had no idea this existed. In which version was it first implemented?

Xof at 11:24, 1 March 2016:

The include directive? That’s been there for a while; 9.x at least.