When the `ON CONFLICT` clause is triggered, it still causes a new tuple in Postgres to be written even if the value of all the columns is the same. Making a new tuple means that the table needs to be vacuumed sooner and leads to more work and churn for the database and its storage. But, there is a way to prevent this unnecessary churn: Postgres supports a `WHERE` clause on the `ON CONFLICT DO UPDATE` that allows us to not write a new row if the data would be the same. While testing this, it already showed it can prevent unnecessary updates to the `tokens` table when the MetadataUpdater is running.pull/1260/head
parent
85883011eb
commit
04d3644839
Loading…
Reference in new issue