How to find limits of GUC parameter in PostgreSQL

1. Introduction

PostgreSQL has many configuration parameters which control server behavior, so called GUC parameter. For example, work_mem control max amount of memory which is used postgres server when hash join, etc. are executed. There are no description upper limit or lower limit of some GUC parameters in PostgreSQL official document. I know there are some documentations on GUC parametes, for example, [1], etc. But I want to find limits of GUC parameters myselef. So I searched codes which means set limits of GUC parametes in PostgreSQL source code.

2. Prerequisites

Version of PostgreSQL: PostgreSQL13.0

3. What I find

Codes which mean declarations of GUC parameter are contained in guc.c.
https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/guc.c
Some arrays of any struct, for example, struct config_int, contains declarations of GUC parameter.
Such structs are declared in guc_tables.h.
https://github.com/postgres/postgres/blob/master/src/include/utils/guc_tables.h
And such structs has minimum value and maximum value of GUC parameter.
For example, in guc.c, a variable of struct config_int for work_mem is initialized as min = 64(64kB) and max = 2147483647(2147483647kB).

4. References

[1] OnGres Inc., PARAMETERS DOCUMENTATION
https://postgresqlco.nf/doc/en/param/

Published by Yuuki Fujii

I love open souce database management systems.

Leave a comment

Your email address will not be published. Required fields are marked *