Urgent.News

What's breaking now, across thousands of outlets.

Tech

Read your own writes, off the primary

The modern application architecture shifts the challenges associated with database replication lag to the frontend, making it more difficult to manage. When a user makes a change, it is processed in parallel with other tasks, leading to inconsistencies across different tabs and devices. To address this, PostgreSQL 19 introduces a way to query the replication lag on the standby database.

By using the `WAIT FOR` statement, developers can control when a read operation waits for the standby to process the data. This allows for better handling of replication lag and ensures that reads are served correctly. Remote_apply is the setting that best resolves the lag issue, as it makes every commit on the primary wait for replay on the standby, ensuring that the data is visible to queries.

The configuration of the standby's replay mode and timeout settings further optimize the performance by ensuring that the reads are directed to the primary when needed.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at boringsql.com →

More in Tech

How I Built a Desktop Movie Streamer with Electron and WebTorrent

I built CinePeer , a desktop streaming app: a Prime Video-style interface where you browse with TMDB metadata, click play, and the video starts while the torrent is still downloading .

  • CinePeer is a desktop streaming app like Prime Video
  • WebTorrent creates File object for torrented videos
  • Electron main process handles HTTP server for range requests

More from Wednesday 2 September →