Re:The Internals of PostgreSQL
by senderista on Wednesday November 04, 2026 @01:13PM
(#50369386)
Postgres folks will need to correct me but I believe the append-only MVCC design originated from the original "time-travel" requirement (which IIRC was soon dropped). There are better approaches to time-travel anyway such as time-split B-trees (https://www.microsoft.com/en-us/research/wp-content/uploads/...).
[ Parent
| on HN ]
Re:The Internals of PostgreSQL
by xyzzy_plugh on Wednesday November 04, 2026 @01:21PM
(#50369491)
Yes and that would make sense, and what I would expect, if it were available. I understand it is load-bearing but it is nonetheless surprising that it hasn't been revisited. It is surprising, at least to me, that time-travel never shipped given its feasibility.
Re:The Internals of PostgreSQL
by mike_hearn on Thursday November 05, 2026 @02:36AM
(#50376267)
You can do time travel with any MVCC design. Undo logging is well suited to it and Oracle ships several forms of time travelling SQL under the name Flashback.
The simplest form of Flashback just uses the undo logs. Normally undo is deleted once no live transaction uses it, but you can set a retention time to allow SELECT ... AS OF ... queries to go back at least that far.
However, keeping undo logs around forever isn't practical. If you want to go back a year then there's Flashback Time Travel which copies old data into tables in a form that the query engine can use to answer AS OF queries more efficiently.
Re:The Internals of PostgreSQL
by senderista on Thursday November 05, 2026 @12:22PM
(#50381748)
The time-split B-tree is designed to make time-travel queries efficient in both time and space. That is not a trivial problem.
Re:The Internals of PostgreSQL
by mike_hearn on Friday November 06, 2026 @03:45AM
(#50389761)
Hah, interesting. I need to investigate that data structure. I don't know if Flashback uses it either - if you enable the time travel feature then undo logs are processed into internal tables partitioned by SCN, but I suppose it's possible those tables are stored in a different way to regular heap-organized or index-organized tables.
Re:The Internals of PostgreSQL
by senderista on Friday November 06, 2026 @02:03PM
(#50396794)
The nodes in a time-split B-tree tile the 2-D time/primary-key space in an arbitrary way except they must cover it fully with no overlaps (think of each node as an arbitrary rectangle with primary key as one axis and time as the other). That gives you a lot of freedom in how you partition the space, allowing you to exploit local sparsity in either the time distribution or the primary key distribution.
Re:The Internals of PostgreSQL
by mike_hearn on Saturday November 07, 2026 @01:24PM
(#50406744)
Thanks, that's interesting!