4

Error:

2020-04-25 05:42:49.617 EDT [11233] ERROR:  could not map dynamic shared memory segment
2020-04-25 05:42:49.617 EDT [11234] ERROR:  could not map dynamic shared memory segment
2020-04-25 05:42:49.628 EDT [3938] someuser@somedb ERROR:  too many dynamic shared memory segments

This dynamic shared memory error has started to show in the log.

Should I need to reduce work_mem?

PostgreSQL version: postgres (PostgreSQL) 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1)

2
  • Is this the only ERROR, or is there an immediately preceding one? Can you show the query? I would not expect work_mem to be relevant here.
    – jjanes
    Apr 26, 2020 at 17:46
  • Yes, there was a nested query statement followed by parallel failed warning: 2020-04-25 05:42:49.870 EDT [11238] ERROR: could not map dynamic shared memory segment 2020-04-25 05:42:49.872 EDT [25932] LOG: worker process: parallel worker for PID 3939 (PID 11237) exited with exi t code 1
    – CJ Chang
    Apr 27, 2020 at 2:47

1 Answer 1

0
shmmax_limit=$(sysctl -n kernel.shmmax)
echo "System limits:"
echo "shmall: $shmall_limit"
echo "shmmax: $shmmax_limit"

postgresql_conf="/path/to/postgresql.conf"  # Replace with the actual path to postgresql.conf
shared_buffers_new="16MB"  # Adjust the new value as needed
sed -i "s/^shared_buffers *=.*/shared_buffers = $shared_buffers_new/" $postgresql_conf

sudo systemctl restart postgresql

echo "PostgreSQL restarted successfully."

Checking system limits, adjusting PostgreSQL configuration, and restarting PostgreSQL

1
  • The summary is good. The answer could be improved by explaining each option, to help future visitors. Links to references would be even better. Jul 20, 2023 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.