frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

AWS open-sourced Postgres active-active replication extension

https://github.com/aws/pgactive
115•ForHackernews•6h ago

Comments

zknill•2h ago
Looks like it uses Postgres Logical replication to share changes made on one postgres instance to another. Conflict resolution is last-write-wins based on timestamp. Conflicting transactions are logged to a special table (pgactive_conflict_history), so you can see the history, resolve, etc.

https://github.com/aws/pgactive/tree/main/docs

kosolam•1h ago
Sounds interesting. So how soon one knows if his write has been accepted or rejected? Is it immediate or eventual?
ForHackernews•1h ago
It's eventual consistency: Latest-write wins after the dust settles.

As I understand it, this is a wrapper on top of Postgres' native logical replication features. Writes are committed locally and then published via a replication slot to subscriber nodes. You have ACID guarantees locally, but not across the entire distributed system.

https://www.postgresql.org/docs/current/logical-replication....

gritzko•1h ago
So the outcomes are essentially random?

It all feels like they expect developers to sift through the conflict log to resolve things manually or something. If a transaction did not go through on some of the nodes, what are the others doing then? What if they can not roll it back safely?

Such a rabbit hole.

zknill•1h ago
Typically applications will have some kind of logical separation of the data.

Given this is targeted at replication of postgres nodes, perhaps the nodes are deployed across different regions of the globe.

By using active-active replication, all the participating nodes are capable of accepting writes, which simplifies the deployment and querying of postgres (you can read and write to your region-local postgres node).

Now that doesn't mean that all the reads and writes will be on conflicting data. Take the regional example, perhaps the majority of the writes affecting one region's data are made _in that region_. In this case, the region local postgres would be performing all the conflict resolution locally, and sharing the updates with the other nodes.

The reason this simplifies things, is that you can treat all your postgres connections as-if they are just a single postgres. Writes are fast, because they are accepted in the local region, and reads are replicated without you having to have a dedicated read-replica.

Ofc you're still going to have to design around the conflict resolution (i.e. writes for the same data issued against different instances), and the possibility of stale reads as the data is replicated cross-node. But for some applications, this design might be a significant benefit, even with the extra things you need to do.

gritzko•1h ago
I think I understand the use case. Like, we have in fact several regional Postgreses, but we want them to be one physical database for the sake of simplicity. Probably this should be in the motivational part of the README.
ForHackernews•1h ago
In our case, we're designing around INSERT-only tables with a composite primary key that includes the site id, so (in theory) there will never be any conflicts that need resolution.
zozbot234•38m ago
> with a composite primary key that includes the site id

It doesn't look like you'd need multi master replication in that case? You could simply partition tables by site and rely on logical replication.

ForHackernews•18m ago
I think that's absolutely true in the happy scenario when the internet is up.

There's a requirement that during outages each site continue operating independently and might* need to make writes to data "outside" its normal partition. By having active-active replication the hope is that the whole thing recovers "automatically" (famous last words) to a consistent state once the network comes back.

shermantanktop•1h ago
There’s no free lunch. The rabbit hole is only worth going down if the benefits are worth the operational pain. I view this as a building block, not a checkbox feature that magically just works all the time.

For someone who has these requirements out of the gate, another datastore might be better. But if someone is already deeply tied to Postgres and perhaps doing their own half assed version of this, this option could be great.

ForHackernews•45m ago
What are good off-the-shelf distributed databases? We looked at MongoDB but it wasn't worth giving up SQL. To reiterate the no free lunch point, no one has figured out how to outsmart the CAP theorem yet, so all you can do is design around it.
whizzter•36m ago
My guess is that you want to change your entire design philosophy a little bit with regards to table design, moving some entities to use a composite GUID+timestamp as PK's and replace most updates with inserts to avoid conflicts and instead resolve things at query-time (Basically a CRDT modelling philosophy contained within a relational schema).

Ideal? Not entirely but it should still give most query benefits of regular SQL and allows one to to benefit from good indexes (the proper indexes of an SQL database will also help contain the costs of an updated datamodel).

I think this is more interesting for someone building something social media like perhaps rather than anything involving accounting.

rjbwork•29m ago
Are there any Datomic-like query layers on top of Postgres for approaches like this where you're recording immutable occurrences rather than updating mutable records?
zozbot234•35m ago
> So the outcomes are essentially random?

In principle you could use CRDTs to end up with a "not quite random" outcome that simply takes the conflict into account - it doesn't really attempt to "resolve" it. That's quite good for some cases.

okigan•1h ago
It took 20 years to acknowledge that pushing eventual consistency to application layer is not worth it for most applications.

Seems the same is playing out out in Postgres with this extension, maybe will take it another 20 years

zozbot234•43m ago
Is this multi-master replication? It will be interesting if it can be accepted into Postgres proper.
everfrustrated•1h ago
I'm scratching my head trying to think why AWS would have worked on this? I can't think of it being used in any of their products.

RDS uses block replication. Aurora uses it's own SAN replication layer.

DMS maybe?

gotimo•1h ago
probably [Aurora DSQL](https://aws.amazon.com/rds/aurora/dsql/) which released a couple of weeks ago
fizx•1h ago
I thought dsql was distributed transactions. :thinking:
loginatnine•32m ago
It's definitely DSQL with the multi-region active active feature[1].

[1]https://aws.amazon.com/rds/aurora/dsql/features/#topic-1

the_precipitate•1h ago
Yeah, and this doesn't seems to be that useful. At least I don't understand why one should do this on a strong ACID relational database.
hobs•1h ago
In my experience multi-writer is because of latency or HADR stuff - have all your data in all regions at the same time, but the method (via the tlog) seems like it sort of defeats what those sorts of systems might be able to historically do (write multiple places from the app at the same time so as to have the lowest possible chance of data loss.)
shermantanktop•1h ago
Yes, I call it spoke-and-hub. The sharded spokes accept the writes and replicate back to the hub, where all shards coexist.

Useful for metric ingestion. Not useful for bank ledgers or whatever.

hobs•49m ago
Yeah, some instances also have all the shards maintain all the state and just accept writes in your partition of values, merge replication in sql server works like this.
ForHackernews•1h ago
Apparently they've offered it as a feature in RDS Postgres for a couple years now https://aws.amazon.com/about-aws/whats-new/2023/10/pgactive-...

But only last month did they officially release it as open source to the community https://aws-news.com/article/2025-06-09-announcing-open-sour...

thayne•9m ago
> Aurora uses it's own SAN replication layer

I don't think that is used for cross region replication

ltbarcly3•9m ago
Don't use this unless you know exactly what you are doing.

This is not a way to get better performance or scalability in general.

Stateless Probabilistic Minesweeper

https://github.com/ronanyeah/sat-minesweeper
1•ronanyeah•23s ago•1 comments

Undiscovered galaxies could be orbiting the Milky Way

https://abcnews.go.com/US/100-undiscovered-galaxies-orbiting-milky-new-research/story?id=123766665
1•Brajeshwar•2m ago•0 comments

'It's just a weird, weird bird': Why we got the dodo so wrong

https://www.bbc.com/future/article/20250714-why-history-got-the-dodo-so-absurdly-wrong
1•Brajeshwar•3m ago•0 comments

Show HN: GitGuard - Painless GitHub PR Automations

https://gitguard.dev/
1•habosa•3m ago•0 comments

What people said about an OpenZFS bug

https://despairlabs.com/blog/posts/2025-07-13-an-openzfs-bug-and-the-humans-that-made-it-comments/
1•todsacerdoti•3m ago•0 comments

AI scientists warn: We're losing our only window into how AI thinks

https://qz.com/ai-scientists-warning-openai-google-deepmind-meta
1•Bluestein•5m ago•0 comments

The Italian towns selling houses for €1

https://www.theguardian.com/society/2025/jul/08/the-life-swap-dream-or-a-marketing-gimmick-the-italian-towns-selling-houses-for-1
13•lazydogbrownfox•5m ago•6 comments

Philadelphia’s newest and smallest art museum

https://www.msn.com/en-us/travel/tripideas/philadelphia-s-newest-and-smallest-art-museum-is-ready-for-its-close-up/ar-AA1IyCUM
2•fishthethis•6m ago•0 comments

Online archive of music treatises at the Fryderyk Chopin Institute

https://musictreatises.nifc.pl/en
1•danielam•6m ago•0 comments

Google, Westinghouse use GenAI to boost reactor construction, optimize operation

https://www.theregister.com/2025/07/16/google_westinghouse_ai_nuclear/
1•rntn•7m ago•0 comments

RFK Jr. and other Trump officials embrace psychedelics after FDA setback

https://apnews.com/article/psychedelics-rfk-jr-kennedy-ibogaine-mdma-4e59a3eb2d23d98f2579d25c73c34e9b
1•petethomas•8m ago•0 comments

Show HN: Open-source image restylization canvas

https://infinite-kanvas.com
1•treesciencebot•9m ago•0 comments

Mill: A Better Build Tool for Java, Scala, & Kotlin

https://mill-build.org/mill/index.html
2•lihaoyi•9m ago•0 comments

Chinese authorities are using a new tool to hack seized phones and extract data

https://techcrunch.com/2025/07/16/chinese-authorities-are-using-a-new-tool-to-hack-seized-phones-and-extract-data/
1•moose44•10m ago•0 comments

Show HN: Seal.codes – Verify content authenticity right in the browser

1•utsavanand2•12m ago•0 comments

Migrating Classic LangChain Agents to LangGraph a How To

https://focused.io/lab/a-practical-guide-for-migrating-classic-langchain-agents-to-langgraph
1•austinbv•12m ago•0 comments

David Lynch's Sony Camcorder

https://obsoletesony.substack.com/p/david-lynchs-favorite-sony-camcorder
1•coloneltcb•13m ago•0 comments

Mercedes Benz to Incorportate Microsoft Teams, Intune, and Copilot into Vehicles

https://media.mercedes-benz.com/article/931e7af1-2d57-4e90-9e1e-252289e70648
1•consumer451•13m ago•1 comments

Gaslight-Driven Development

https://tonsky.me/blog/gaslight-driven-development/
1•potetm•15m ago•0 comments

'Too many old people': A rural Pa. town reckons with population loss

https://www.washingtonpost.com/nation/2024/06/23/rural-america-shrinking-population-pennsylvania/
4•Ozarkian•16m ago•1 comments

Ask HN: How are you doing code gen in the Enterprise?

1•canterburry•16m ago•0 comments

The value of trees outside woods for promoting biodiversity on farmland

https://besjournals.onlinelibrary.wiley.com/doi/10.1002/2688-8319.70042
1•PaulHoule•18m ago•0 comments

AWS announces Bedrock AgentCore to deploy and operate AI agents at any scale

https://aws.amazon.com/blogs/aws/introducing-amazon-bedrock-agentcore-securely-deploy-and-operate-ai-agents-at-any-scale/
1•hqm_•19m ago•0 comments

Ask HN: Good guides to securing containers used for unsupervised agentic coding

1•prmph•19m ago•0 comments

Super Mario Odyssey is the purest form of Mario

https://ravi64.com/super-mario-odyssey-purest-form-of-mario/
2•outrunner•20m ago•0 comments

MindTrip AI

https://mindtrip.ai
1•eddieweng•23m ago•0 comments

Artificial Finance: How AI Thinks About Money

https://arxiv.org/abs/2507.10933
1•bikenaga•25m ago•0 comments

Astronomers witness the birth of a planetary system [video]

https://www.space.com/astronomy/astronomers-witness-the-birth-of-a-planetary-system-for-the-1st-time-photo-video
1•DocFeind•25m ago•0 comments

Underused Techniques for Effective Emails

https://refactoringenglish.com/chapters/techniques-for-writing-emails/
2•mtlynch•26m ago•1 comments

CERN Physicists Find Key Piece of the Matter-Antimatter Puzzle

https://gizmodo.com/cern-physicists-find-key-piece-of-the-matter-antimatter-puzzle-2000629084
2•DocFeind•26m ago•0 comments