Description of shared storage in Postgres: https://wiki.postgresql.org/wiki/Shared_Storage

Related question: https://serverfault.com/a/620315/137464

Both of these make it clear that it's not safe to have one write instance and many readers. What about if all instances are read-only?


In the answer you linked to, Craig says:

It's possibly practical to do it with minor changes to PostgreSQL( if all the servers are read-only, but I haven't investigated it as it's a pretty uninteresting use-case.

(emphasis mine).

The problem is, there is no way to start a PostgreSQL server and tell it "you are only allowed to look at this data directory, you are not allowed to write anything at all". Even a PostgreSQL server operating as a "hot standby" takes the liberty of writing arbitrary files inside its data directory (e.g. postmaster.pid, temporary files used for on-disk sorts, rewriting hint bits, and so on). If two or more servers were coaxed into operating in hot standby mode against the same data directory, chaos could ensue.

There is simply no "look but don't touch" mode for a Postgres server, so the answer to:

What about if all [Postgres server instances operating against the same shared data directory] are read-only?

is: not possible today without changing Postgres to implement a true read-only mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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