We made Postgres writes faster, but it broke replication

paradedb.com

241 points by philippemnoel 2 days ago


timetoogo - 2 days ago

Love this style of no-fluff technical deep dive. HN needs more content like this.

kikimora - 2 days ago

Agree with others saying HN needs more content like this!

After reading I don’t get how locks held in memory affect WAL shipping. WAL reader reads it in a single thread, updates in-memory data structures periodically dumping them on disk. Perhaps you want to read one big instruction from WAL and apply it to many buffers using multiple threads?

>Adapting algorithms to work atomically at the block level is table stakes for physical replication

Why? To me the only thing you have to do atomically is WAL write. WAL readers read and write however they want given that they can detect partial writes and replay WAL.

>If a VACUUM is running on the primary at the same time that a query hits a read replica, it's possible for Postgres to abort the read.

The situation you referring to is: 1. Record inserted 2. Standby long query started 3. Record removed 4. Primary vacuum started 5. Vacuum replicated 6. Vacuum on standby cannot remove record because it is being read by the long query. 7. PG cancels the query to let vacuum proceed.

I guess your implementation generates a lot of dead tuples during compaction. You clearly fighting PG here. Could a custom storage engine be a better option?

otterley - 2 days ago

> To be an effective alternative to Elasticsearch we needed to support high ingest workloads in real time.

Why not just use OpenSearch or ElasticSearch? The tool is already in the inventory; why use a screwdriver when a chisel is needed and available?

This is another one of those “when you have a hammer, everything looks like your thumb” stories.