frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

What if database branching was easy?

https://xata.io/blog/what-if-database-branching-was-easy
23•tee-es-gee•2d ago

Comments

comrade1234•1h ago
I was on a big team working on a giant oracle database over 25-years ago. I dont remember the term but each developer had their own playground of the giant database that wasn't affected by anyone else. The DB admin would set it up for each developer in just a few minutes so it definitely wasn't a copy. Then when a developer needed to reset and go back to the original db again it just took a few minutes. I just don't remember what it's called but I think Postgres has had it now for a few years.
tremon•54m ago
You don't actually need to physically copy data, just create a view for every table that does a replacing merge between the original read-only data and the developer's own copy. And you can put a trigger on the view to redirect writes to the same private-copy table, making the whole thing transparent to the user.

Not disputing that Oracle might have had something like this built-in, but it sounds like something that I could have whipped up in a day or so as a custom solution. I actually proposed a similar system to create anonymized datasets for researchers when I worked at a national archive institute.

TheMrZZ•40m ago
Snowflake uses a similar system with their 0-copy cloning. It starts with the original table's partition, and keeps track of the delta created by subsequent operations. Always found that builtin mechanism pretty neat!
hilariously•11m ago
Sounds like a snapshot - a file based diff of the pages changed since the last full backup - easy to revert to for the same reasons.
Nihilartikel•1h ago
This kind of magic is the reason that I'm very itchy to be able to line up real work on Datomic or XTDB someday.
xeubie•37m ago
Surprisingly, neither Datomic nor XTDB support branching. See: https://blog.danieljanus.pl/datomic-forking-the-past/

I actually built my own immutable database which does support branching (see profile), so it seems like a huge miss that these ones don't. It's pretty much the main reason I would want an immutable database.

theaniketmaurya•1h ago
i was using neon and they had some similar feature but now using planetscale. would be curious to know how you all are doing it?
miketery•37m ago
We used neon at last job. It seemed pretty cool. What made you switch to planetscale?
sastraxi•59m ago
I’ve done experiments using BTRFS and ZFS for local Postgres copy-on-write. You don’t need anything but vanilla pg and a supported file system to do it anymore; just clone the database using a template and a newish version of Postgres.

Looking at Xata’s technical deep dive, the site claims that we need an additional Postgres instance per replica and proposes a network file system to work around that. But I don’t really understand why that’s needed. Can someone explain to me my misunderstanding here?

eatonphil•32m ago
I also don't really understand how being correct under physical branching with ZFS, or physical backups of a filesystem, are different from crash safety in general. As long as you replay the WAL at the point where you branch (or take a physical backup of the filesystem) you should not lose data?

At the same time Postgres people don't seem comfortable with the idea in practice so I'm not sure if this is actually ok to do.

hilariously•12m ago
Crash safety does mean rollbacking all things in progress, but yes, if your database cannot safely do it (even if it is yucky) then you do not have a safe database for any crash situation.
sgarland•20m ago
> Imagine you need to add an index to a table with a few million rows. On a seeded database with 200 rows, the migration runs in milliseconds. Obviously. But on a branch with realistic data, it takes 40 seconds and needs CREATE INDEX CONCURRENTLY to avoid locking the table. The branch is isolated, so locking there isn't the issue — the point is that the rehearsal shows the production migration would need CONCURRENTLY.

A few million rows should take at most, on the most awful networked storage available, maybe 10 seconds. I just built an index locally on 10,000,000 rows in 4 seconds. Moreover, though, there are vanishingly few cases where you wouldn't want to use CONCURRENTLY in prod - you shouldn't need to run a test to tell you that.

IMO branching can be a cool feature, but the use I keep seeing touted (indexes) doesn't seem like a good one for it. You should have a pretty good idea how an index is going to behave before you build it, just from understanding the RDBMS. There are also tools like hypopg [0], which are also available on cloud providers.

A better example would be showing testing a large schema change, like normalizing a JSON blob into proper columns or something, where you need to validate performance before committing to it.

0: https://github.com/HypoPG/hypopg

Show HN: Saunas lower nighttime heart rate more than exercise (n=59,000)

https://tryterra.co/research/sauna-effect-on-heart-rate
46•kyriakosel•24m ago•20 comments

ggsql: A Grammar of Graphics for SQL

https://opensource.posit.co/blog/2026-04-20_ggsql_alpha_release/
76•thomasp85•1h ago•17 comments

GitHub's Fake Star Economy

https://awesomeagents.ai/news/github-fake-stars-investigation/
363•Liriel•5h ago•223 comments

M 7.4 earthquake – 100 km ENE of Miyako, Japan

https://earthquake.usgs.gov/earthquakes/eventpage/us6000sri7/
116•Someone•4h ago•51 comments

10 years ago, someone wrote a test for servo that included an expiry in 2026

https://mastodon.social/@jdm_/116429380667467307
33•luu•18h ago•7 comments

Atlassian Enables Default Data Collection to Train AI

https://letsdatascience.com/news/atlassian-enables-default-data-collection-to-train-ai-f71343d8
27•kevcampb•1h ago•5 comments

WebUSB Extension for Firefox

https://github.com/ArcaneNibble/awawausb
24•tuananh•2h ago•22 comments

All phones sold in the EU to have replaceable batteries from 2027

https://www.theolivepress.es/spain-news/2026/04/20/eu-to-force-replaceable-batteries-in-phones-an...
31•ramonga•23m ago•9 comments

NSA is using Anthropic's Mythos despite blacklist

https://www.axios.com/2026/04/19/nsa-anthropic-mythos-pentagon
204•Palmik•4h ago•161 comments

Focused microwaves allow 3D printers to fuse circuits onto almost anything

https://newatlas.com/electronics/meta-nfc-focused-microwaves-circuits/
80•breve•2d ago•14 comments

Up to 8M Bees Are Living in an Underground Network Beneath This Cemetery

https://www.discovermagazine.com/up-to-8-million-bees-are-living-in-an-underground-network-beneat...
111•janandonly•2d ago•15 comments

SDF Public Access Unix System

https://sdf.org/?ssh
116•neehao•1d ago•50 comments

Vercel April 2026 security incident

https://www.bleepingcomputer.com/news/security/vercel-confirms-breach-as-hackers-claim-to-be-sell...
804•colesantiago•23h ago•460 comments

What if database branching was easy?

https://xata.io/blog/what-if-database-branching-was-easy
23•tee-es-gee•2d ago•12 comments

Stop trying to engineer your way out of listening to people

https://ashley.rolfmore.com/stop-trying-to-engineer-your-way-out-of-listening-to-people/
315•walterbell•17h ago•161 comments

I Made the "Next-Level" Camera and I love it

https://thelibre.news/i-made-the-next-level-camera-and-i-love-it/
124•ndr•3d ago•25 comments

Claude Token Counter, now with model comparisons

https://simonwillison.net/2026/Apr/20/claude-token-counts/
160•twapi•13h ago•62 comments

Epicycles All the Way Down (2025)

https://www.strangeloopcanon.com/p/epicycles-all-the-way-down
13•surprisetalk•3d ago•5 comments

Zero-copy protobuf and ConnectRPC for Rust

https://medium.com/@iainmcgin/zero-copy-protobuf-and-connectrpc-for-rust-69bda8ac0f02
95•PaulHoule•3d ago•29 comments

A Brief History of Fish Sauce

https://www.legalnomads.com/fish-sauce/
197•vinhnx•1d ago•84 comments

How Motorola’s 2N2222 and 2N3904 transistors became the default NPNs

https://www.allaboutcircuits.com/news/how-two-motorola-transistors-became-the-worlds-default-npns/
49•ChuckMcM•2d ago•17 comments

NASA Artemis Posters

https://www.nasa.gov/gallery/artemis/
31•bookofjoe•1h ago•5 comments

Ask HN: How to solve the cold start problem for two-sided marketplace?

3•alegd•22m ago•3 comments

Turtle WoW classic server announces shutdown after Blizzard wins injunction

https://www.pcgamer.com/games/world-of-warcraft/turtle-wow-classic-server-announces-shutdown-afte...
276•Brajeshwar•22h ago•243 comments

Ben Lerner's Big Feelings

https://www.vulture.com/article/ben-lerner-transcription-interview.html
39•prismatic•4d ago•20 comments

The Bromine Chokepoint

https://warontherocks.com/cogs-of-war/the-bromine-chokepoint-how-strife-in-the-middle-east-could-...
209•crescit_eundo•20h ago•122 comments

Monumental ship burial beneath ancient Norwegian mound predates the Viking Age

https://phys.org/news/2026-04-monumental-ship-burial-beneath-ancient.html
74•pseudolus•3d ago•20 comments

Stripe's Payment APIs: the first 10 years (2020)

https://stripe.dev/blog/payment-api-design
80•tibbar•8h ago•40 comments

Mechanical Keyboard Sounds – A listening Museum

https://sheets.works/data-viz/keyboard-sounds
164•akashwadhwani35•4d ago•47 comments

Who Is Blake Whiting?

https://theamericanscholar.org/who-is-blake-whiting/
24•Caiero•2d ago•4 comments