According to the reference documentation the READ ONLY transaction flag is useful other than allowing DEFERRABLE transactions?
SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;
The DEFERRABLE transaction property has no effect unless the transaction is also SERIALIZABLE and READ ONLY. When all three of these properties are selected for a transaction, the transaction may block when first acquiring its snapshot, after which it is able to run without the normal overhead of a SERIALIZABLE transaction and without any risk of contributing to or being canceled by a serialization failure. This mode is well suited for long-running reports or backups.
Does the database engine runs other optimizations for read-only transactions?
READ ONLYtransaction should be the same as aREAD WRITEtransaction which only contains reads. This stems from the way Postgres handles XID assignment (some info on this here). - Nick BarnesREAD ONLYis really more of a safety thing. - Craig Ringerdeferrable. The docs say "deferrable ... may be delayed before it is allowed to proceed ... once it begins ... it does not incur any of the overhead required to ensure serializability; so serialization code will have no reason to force it to abort ... making this option suitable for long-running read-only transactions". There is definitely benefit to not being canceled, but is that potential delay trade-off worth it forreduced serialization overheads? Not for a short-running query. - Davos