docker-postgis icon indicating copy to clipboard operation
docker-postgis copied to clipboard

Disabling fsync

Open simplenotezy opened this issue 2 years ago • 2 comments

I'd like to disable fsync - is there a way to do this with this image?

simplenotezy avatar Jun 20 '22 00:06 simplenotezy

Hi simplenotezy,

I'd like to disable fsync - is there a way to do this with this image?

these repo images are just an extension of the docker-library/postgres images so all upstream customization should work.

see https://github.com/docker-library/docs/blob/master/postgres/README.md#database-configuration

  • "Use a custom config file ...."
  • "Set options directly on the run line. ... "

example: the postgis/postgis:14-3.2

  • source code is https://github.com/postgis/docker-postgis/blob/master/14-3.2/Dockerfile
  • and based on FROM postgres:14-bullseye

So check the upstream repo:

  • https://github.com/docker-library/postgres/search?q=fsync&type=issues
    • https://github.com/docker-library/postgres/issues/149#issuecomment-215619199 command: -c fsync=off
      • and this should work with the postgis/postgis images!

And working :

$ docker run -d --name postgis_fsyncoff -e POSTGRES_PASSWORD=mypw postgis/postgis:14-3.2  -c fsync=off -c shared_buffers=720MB -c max_connections=42

$ docker exec -ti postgis_fsyncoff psql -U postgres

psql (14.3 (Debian 14.3-1.pgdg110+1))
Type "help" for help.

postgres=# show fsync;
 fsync 
-------
 off
(1 row)

ImreSamu avatar Jun 20 '22 01:06 ImreSamu

Side note, disabling fsync is usually a bad idea - disabling synchronous_commit brings the perf improvements without the risks instead.

Komzpa avatar Jun 20 '22 05:06 Komzpa