Ankit Gupta’s Post

𝐎𝐮𝐫 𝐂𝐏𝐔 𝐡𝐢𝐭 𝟗𝟗% 𝐚𝐧𝐝 𝐧𝐨𝐭𝐡𝐢𝐧𝐠 𝐥𝐨𝐨𝐤𝐞𝐝 𝐰𝐫𝐨𝐧𝐠 We had rising CPU, slow APIs, and zero complex queries. Just plain UPDATEs. 𝐖𝐡𝐚𝐭 𝐰𝐞 𝐦𝐢𝐬𝐬𝐞𝐝 In PostgreSQL, UPDATE does not overwrite a row. It creates a new tuple and keeps the old one. Every update = more data. 𝐖𝐡𝐚𝐭 𝐡𝐚𝐩𝐩𝐞𝐧𝐞𝐝 𝐢𝐧 𝐩𝐫𝐨𝐝 • Same rows updated again and again • Dead tuples kept increasing • Tables silently bloated • Queries got slower over time 𝐓𝐡𝐞 𝐫𝐞𝐚𝐥 𝐢𝐬𝐬𝐮𝐞 Not bad queries. Not bad indexes. Just misunderstood database behavior. 𝐖𝐡𝐚𝐭 𝐟𝐢𝐱𝐞𝐝 𝐢𝐭 • Reduced unnecessary updates • Shortened transactions • Let vacuum catch up 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲 If your system updates the same rows frequently, you are not just updating data. You are creating more of it. And that adds up fast. #PostgreSQL #BackendEngineering #SystemDesign #DatabaseInternals #PerformanceOptimization #Scalability #SoftwareEngineering #MVCC #TechLearning #Java #SpringBoot

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories