Sample Header Ad - 728x90

How to Sum and Update a Value by Key in PostgreSQL Without Causing Table Bloat?

-1 votes
1 answer
98 views
I'm working with a PostgreSQL database where I need to store a numerical value associated with a specific key. Over time, I will be continuously adding to this value based on the key. I want to ensure that the table doesn't get bloated with multiple row versions or dead tuples, especially as this update operation will be frequent (like 100 req/s). 1. What are the best practices in PostgreSQL to accomplish this? 2. Should I use INSERT ON CONFLICT, a trigger, or another approach? 3. How can I ensure that my table remains efficient and doesn't suffer from excessive bloat due to frequent updates?
Asked by Andrei (111 rep)
Aug 27, 2024, 06:05 PM
Last activity: Aug 28, 2024, 07:33 AM