Show HN: SirixDB 1.0 Beta – Git-Like Versioning, Diffs, Time-Travel Queries(github.com)
github.com
Show HN: SirixDB 1.0 Beta – Git-Like Versioning, Diffs, Time-Travel Queries
https://github.com/sirixdb/sirix
6 comments
Im developing something vaguely in the same space (tamper proof audit log) - (or several things since I also have a custom temporal object mapper for postgres); what is the advantage of this project? It doesnt seem sql-compliant (afaik bitemporal operations are part of the SQL-2011 standard), and what this could add -tamper detection - seems absent. Not criticizing, just trying to understand the use case.
No, it's first and foremost a document store / so for JSON or XML currently, that's why it's not SQL compliant. I think other query languages as JSONiq are much more tailored to this, albeit a niche of course (based on XQuery).
Regarding tamper proof audit logs not much is missing. Cryptographic hashes instead of XXH3, a commit hash chain and signed commits. Actually, I think that's a great addition with minimal changes needed.
What you can audit currently is "who changed what" for instance.
Regarding tamper proof audit logs not much is missing. Cryptographic hashes instead of XXH3, a commit hash chain and signed commits. Actually, I think that's a great addition with minimal changes needed.
What you can audit currently is "who changed what" for instance.
Oh, and Sirix optionally already stores a rolling merkle hash over the data.
+1 on Johannes
SQL was designed for tables and does this job indisputably well. However, even adding dots, lateral joins, and variants, it was not made for nested, heterogeneous data and reaches its limits with many levels of nestedness or high sparsity/extra fields (aka, denormalized data, aka semi-structured data).
The underlying constructs behind JSONiq and XQuery (which are 99% the same, differing only on the "JSON finish"), in particular the FLWOR expressions (which support pipe-syntax-like clauses natively), were designed in a W3C standardization working group by some of the same experts who also contributed to or edited SQL.
I explain the reasons why SQL is not appropriate for denormalized data in my MSc course at ETH: https://www.youtube.com/watch?v=WBe6MlCM9EY&list=PLs5KPrcFtb...
You will also find our VLDB conference paper on data independence for messy data here: https://www.vldb.org/pvldb/vol14/p498-muller.pdf
I hope it helps!
SQL was designed for tables and does this job indisputably well. However, even adding dots, lateral joins, and variants, it was not made for nested, heterogeneous data and reaches its limits with many levels of nestedness or high sparsity/extra fields (aka, denormalized data, aka semi-structured data).
The underlying constructs behind JSONiq and XQuery (which are 99% the same, differing only on the "JSON finish"), in particular the FLWOR expressions (which support pipe-syntax-like clauses natively), were designed in a W3C standardization working group by some of the same experts who also contributed to or edited SQL.
I explain the reasons why SQL is not appropriate for denormalized data in my MSc course at ETH: https://www.youtube.com/watch?v=WBe6MlCM9EY&list=PLs5KPrcFtb...
You will also find our VLDB conference paper on data independence for messy data here: https://www.vldb.org/pvldb/vol14/p498-muller.pdf
I hope it helps!
Besides, documents are split into fine granular nodes, so we have "no" upper limit besides running out of 48bit nodeKeys/node identifiers at some point maybe.
Furthermore, a (versioned, as always) path summary keeps track of all distinct paths, which is a key ingredient for the optional secondary indexes, which can index paths or paths and content among other stuff as simply indexing fields. Optionally you can also add indexes to speed up aggregate queries (which are basically column projections).
Furthermore, the whole storage can self-validate through checksums stored in parent pages up to the root as in ZFS for instance.
DeweyIDs can be optionally stored for each node, which can speed up the comparison of subtrees between revisions (in order to detect simply which changesets belong to a certain subtree without having to traverse ancestor chains). They lend themselves well for compression.
We even have importers which can identify based on heuristics minimal edit operations to import existing revisions of XML or JSON documents and to commit these with hopefully a minimal or close to minimal set of update operations, but it depends heavily on the data.
Furthermore, a (versioned, as always) path summary keeps track of all distinct paths, which is a key ingredient for the optional secondary indexes, which can index paths or paths and content among other stuff as simply indexing fields. Optionally you can also add indexes to speed up aggregate queries (which are basically column projections).
Furthermore, the whole storage can self-validate through checksums stored in parent pages up to the root as in ZFS for instance.
DeweyIDs can be optionally stored for each node, which can speed up the comparison of subtrees between revisions (in order to detect simply which changesets belong to a certain subtree without having to traverse ancestor chains). They lend themselves well for compression.
We even have importers which can identify based on heuristics minimal edit operations to import existing revisions of XML or JSON documents and to commit these with hopefully a minimal or close to minimal set of update operations, but it depends heavily on the data.
Congratulations, Johannes!
The core idea behind SirixDB is, that history is a first-class citizen. Every commit stores a lightweight, queryable revision. You can query any point in time, even individual nodes (for instance JSON values), diff arbitrary revisions, and efficiently track how data evolved without replaying events.
Unlike traditional event stores, historical states do not need to be reconstructed by replaying events nor do we have to think about projections. Revisions are directly queryable.
A simple example:
Jan 1: Record "Price = $100, valid from Jan 1". Stored on Jan 1 (transaction time).
Jan 20: Discover price was actually $95 on Jan 1. Commit correction.
After correction, you can ask across both axes:
- "What did we THINK the price was on Jan 16?" -> $100 (Transaction time)
- "What WAS the price on Jan 1?" -> $95 (Valid time)
I've worked on this in my spare time since 2013, following its academic precursor (Idefix/Treetank) at the University of Konstanz. The architecture relies on an append-only physical log and a persistent copy-on-write page trie.
A high level view of the architecture:
Physical Log (append-only, sequential writes)
Each revision is indexed, and unchanged pages are shared:
Beneath the root pages sit node and secondary indexes, using a novel sliding-snapshot algorithm to balance read/write performance. Everything is queryable using JSONiq via the Brackit compiler.
Back in 2019, and even in 2023, SirixDB was very slow due to GC pressure. Unlike most other document stores, SirixDB stores fine-grained nodes, and I came to realize that an on-heap (JVM) representation made up of lots of small objects simply didn't make sense. I measured it with async-profiler — with some help from Andrei Pangin himself — and the result was that the poor throughput was due to the sheer amount of allocations which scaled almost linearly with the number of open transactions.
Working a full-time software engineering job, I lacked the energy for a massive spare-time rewrite. About a year ago, I started experimenting with AI. It turned out to be ideal for automating the tedious, repetitive parts of migrating the storage layer to Java's Foreign Function & Memory API, storing pages completely off-heap.
Looking further ahead, the append-only, immutable-page design maps naturally onto object storage like S3 and distributed logs like Kafka for a cloud version, and initial prototypes already exist. Maybe that becomes a commercial service one day, but for now, I'm just thrilled to see these core design principles finally proven out.There's an interactive demo, documentation, and the code is on GitHub. I'd love feedback and am happy to answer questions!
kind regards
Johannes
[1] https://sirix.io | https://github.com/sirixdb/sirix
[2] https://sirix.io/docs/architecture.html
[3] https://demo.sirix.io
[4] https://sirix.io/docs/
[5] http://brackit.io