From 84741de60ebdd06ea9264b6f700cc13f828ecc19 Mon Sep 17 00:00:00 2001 From: Maxime Delporte Date: Tue, 28 Oct 2025 16:29:42 +0100 Subject: [PATCH] Adding 'Optimizing PostgreSQL settings' sub-section. --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7283295..82a7f37 100644 --- a/README.md +++ b/README.md @@ -181,4 +181,23 @@ _A panic typically means something went unexpectedly wrong. Mostly we use it to **json.MarshalIndent()** takes 65% longer to run and uses around 30% more memory than **json.Marshal()**, as well as making two more heap allocations. Those figures will change depending on what you're encoding, but they're fairly indicative of the performance impact. For most applications this performance difference simply isn't something that you need to worry about. In real terms, we're talking about a few thousandths of a millisecond - and the improved readability of responses is probably worth this trade-off. -But if your API is operating in a very resource-constrained environment, or needs to manage extremely high levels of traffic, then this is worth being aware of, and you may prefer to stick with using **json.Marshal()** instead. \ No newline at end of file +But if your API is operating in a very resource-constrained environment, or needs to manage extremely high levels of traffic, then this is worth being aware of, and you may prefer to stick with using **json.Marshal()** instead. + +#### Optimizing PostgreSQL settings + +The default settings that PostgreSQL ships with are quite conservative, and you can often improve the performance of your database by tweaking the values in your **postgresql.conf** file. + +You can check where your **postgresql.conf** file lives with the following SQL query : + +``` postgresql +$ sudo -u postgres psql -c 'SHOW config_file;' +---------------------------------------------- +/etc/postgresql/15/main/postgresql.conf +(1 row) +``` + +To read more about PostgreSQL optimization : +https://www.enterprisedb.com/postgres-tutorials/how-tune-postgresql-memory + +To generate suggested values based on your available system hardware, you can use : +https://pgtune.leopard.in.ua \ No newline at end of file