TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Can PostgreSQL standby read performance go down with writes on master?

17 pointsby avivallssaabout 6 years ago
Someone told me that their usual read queries are performing faster when no writes to Master. Is this possible and what could be the reason behind it ?

1 comment

btownabout 6 years ago
My understanding is that when a standby&#x2F;secondary database receives a replication&#x2F;write-ahead log (WAL) entry from the master, it still needs to process it, just as if it had been committed on its own system. That means ensuring indices are in memory, paging things in and out of memory if needed, etc. And if your reads are of a very different character than your writes, you might see circumstances where the writes cause things to move out of cache - things that would otherwise be in cache due to the read workload alone.<p>In general, standby&#x2F;secondary reads aren&#x27;t a performance panacea. If writes, and their cache contention, are consuming 50% of your CPU and IO on master, they&#x27;ll still consume about as much on secondaries. So don&#x27;t expect to be able to use 100% of the secondary&#x27;s capacity. But it&#x27;s a decent &quot;growth hack&quot; if you can tolerate stale reads and just want a way to scale horizontally without regards to costs.