Changing parameter maintenance_work_mem = 10GB results in error Postgresql 17 #2375
-
What version of osm2pgsql are you using?osm2pgsql version 2.1.1 What operating system and PostgreSQL/PostGIS version are you using?Windows 11 Pro 24H2 Tell us something about your system64GB RAM What did you do exactly?Stopped the postgresql service. Change the postgresql.conf parameters as advised on the osm2pgsql website and tried to restart the service What did you expect to happen?I expcted the postgresql just to work again when I restart the service. What did happen instead?I found out that changing the maintenance_work_mem into 10GB (as advised by osm2pgsql), postgresql doesnt get restarted. It gives the error 'connection refused getsockopt' What did you do to try analyzing the problem?Changing the parameter again in the default value .... and the service gets restarted! So far I have the value up to 256MB and the service still gets restarted, but there is a value that is too much for the system.... |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
This isn't an issue of Postgresql 17. I have multiple machines running Postgresql 17 with that setting enabled. Might be a Windows thing or something else specific to your setup. Please have a look at the Postgresql server logs. There should be an error message there telling you why it refuses to start up. |
Beta Was this translation helpful? Give feedback.
-
Hi @pimmierevrev , The example configuration If you have less memory (e.g., 64 GB in your case),
for example:
And since PostgreSQL’s memory usage and performance can differ slightly on Windows compared to Linux, you may need to reduce these values even further. And as mentioned before, it is also worth checking the PostgreSQL log. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Thank you, didn't notice that.
Above all: wonderfull piece of software, osm2pgsql. Recently switched to lua file. I use visual studio code and python to fully automate
The download off Europe
The extraction of the Netherlands
The import into postgresql
The creationist of views
Additional stuff
Apart from the above mentioned hickup, all works like a charm.
Kind regards,
Pim Verver
Verzonden vanaf Outlook voor Android<https://aka.ms/AAb9ysg>
…________________________________
From: ImreSamu ***@***.***>
Sent: Saturday, August 9, 2025 6:16:23 PM
To: osm2pgsql-dev/osm2pgsql ***@***.***>
Cc: pimmierevrev ***@***.***>; Mention ***@***.***>
Subject: Re: [osm2pgsql-dev/osm2pgsql] Changing parameter maintenance_work_mem = 10GB results in error Postgresql 17 (Discussion #2375)
Tell us something about your system
64GB RAM
Hi @pimmierevrev<https://github.com/pimmierevrev> ,
The example configuration
at https://osm2pgsql.org/doc/manual.html#tuning-the-postgresql-server
is intended for a machine with "128 GB RAM and a fast SSD".
If you have less memory (e.g., 64 GB in your case),
the values should be scaled down accordingly.
As the documentation mentions:
" If your machine has very little memory, you might consider setting autovacuum_max_workers = 1 and reduce autovacuum_work_mem even further. This will reduce the amount of memory that autovacuum takes away from the import process."
for example:
# Options for fast SSD
shared_buffers = 1GB
work_mem = 50MB
wal_level = minimal
checkpoint_timeout = 60min
max_wal_size = 10GB
checkpoint_completion_target = 0.9
max_wal_senders = 0
random_page_cost = 1.0
# Scaled-down memory settings (for less RAM)
maintenance_work_mem = 3GB
autovacuum_work_mem = 1GB
autovacuum_max_workers = 1
And since PostgreSQL’s memory usage and performance can differ slightly on Windows compared to Linux, you may need to reduce these values even further.
This is especially true if, in addition to the PostgreSQL server and osm2pgsql, you are also running a browser and many other programs in the background, as they all share the same 64 GB of RAM.
And as mentioned before, it is also worth checking the PostgreSQL log.
—
Reply to this email directly, view it on GitHub<#2375 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AVFYIEJDQPVOA4REO7OQT3D3MYNFPAVCNFSM6AAAAACDQCO6NKVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIMBVHAYTSMQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@ImreSamu The example configuration in the manual is for a 128 GB RAM machine, that's right. But that doesn't mean it is wrong for other RAM sizes or that's the reason why setting I simply seems there is a limit to how large |
Beta Was this translation helpful? Give feedback.
-
I can confirm that maintenance_work_mem on 1024MB is ok, but 2048 gives the above mentioned error. Maybe it's good to state that in the manual |
Beta Was this translation helpful? Give feedback.
-
I doubt this is a Windows issue. Maybe @pimmierevrev has forgotten to allocate Windows virtual memory though on his machine, to allow some more wiggle room for Windows to deal with memory issues. As @ImreSamu justly pointed out, this is most likely simply a misconfigured PostgreSQL instance, that doesn't properly take into account the (limited) server's resources. There is little sense in adjusting the osm2pgsql documentation for that, users should consult the PostgreSQL docs instead. |
Beta Was this translation helpful? Give feedback.
I can confirm that maintenance_work_mem on 1024MB is ok, but 2048 gives the above mentioned error. Maybe it's good to state that in the manual