Join us

When upserts don't update but still write: Debugging Postgres performance at scale

When upserts don't update but still write: Debugging Postgres performance at scale

The Datadog team introduced a new upsert query to track inactive hosts, but it unexpectedly increased disk writes and WAL syncs due to row locking. By digging into Postgres's Write-Ahead Logging (WAL) and rewriting the query using a Common Table Expression (CTE), they avoided unnecessary overhead and improved performance. The new query eliminated the need for locking and minimized WAL activity and allowed for more efficient host tracking without sacrificing correctness.


Give a Pawfive to this post!


Only registered users can post comments. Please, login or signup.

Start writing about what excites you in tech — connect with developers, grow your voice, and get rewarded.

Join other developers and claim your FAUN.dev() account now!

Avatar

VarBear #SoftwareEngineering

FAUN.dev()

@varbear
SWE Weekly Newsletter, Varbear. Curated Programming news, tutorials, tools and more!
Developer Influence
7

Influence

1

Total Hits

151

Posts