Get the latest tech news
Reads Causing Writes in Postgres
2024-12-21 It is good practice to regularly inspect the statements running in the hot path of your Postgres instance. One way to do this is to examine the pg_stat_statements view, which shows various statistics about the SQL statements executed by the Postgres server.
This article discusses two mechanisms, setting hint bits for transaction state tracking and page pruning, that can cause writes by read-only statements. I briefly touched on this earlier: Tuple 1, being the original row version, is still referenced from the books_pkey index which was automatically created as it backs the primary key constraint on the id column. In this article I tried to provide some details about two mechanisms that can cause writes for simple read queries and some of the implications of Postgres' mutli-version concurrency control.
Or read this on Hacker News