4 ms·
Can someone ELI5 what is an "immutable database"? If you can add to the table, that means mutation, right? I am missing something...
by artemonster 5y ago
Can someone ELI5 what is an "immutable database"? If you can add to the table, that means mutation, right? I am missing something...
- qsort 5y agoIt's immutable in the same sense a purely functional data structure is immutable. You represent mutation by making a new version of the data structure. Of course you don't literally do that on the database because it would be inefficient, but there are several algorithmical tricks that can expose an interface that works as if.
- artemonster 5y agothat makes sense on a language level, when you hold a reference to some data and you can assume nothing can be changed about it. how does that hold on DB level?
- qsort 5y agoIn the same way. A database is basically just a giant data structure, a table is not unlike a B-Tree (in some engines it literally is a B-tree). Data warehouses already do something like this informally, as they are structured in a star schema around a single "append-only" fact table.
- deleted 5y ago[deleted]
- ianpurton 5y agoYou would be able to query and INSERT but not DELETE and UPDATE. This is useful for example in banking applications that keep an audit trail for example. A sysadmin would not be able to update or delete items in the audit table and so can't cover up a crime. If the database is tampered with at the file level, they have a way to detect that. (Probably some kind of merkle tree.)
- artemonster 5y agoallright, makes perfect sense. thank you!
- goto11 5y agoIt basically means "append only". You can add new data to the database, but you can't change or delete existing data.
- dspillett 5y ago> immudb is the first database to provide tamper-evident data management, immutable history and client-cryptographic proof. Every change is preserved and can't be changed without clients noticing. Sounds like they are recording all changes (like SQL2011's system versioned tables, as implemented more-or-less by several common DB engines) but with some sort of hash-chain ledger so that history can be verified and therefore any tampering detected. > If you can add to the table, that means mutation, right? It isn't keeping the current view of the data immutable, but is keeping an immutable history of the data. It is immutable in the sense that nothing written to it is ever lost, and you can use the "time-travel" query functions (like SELECT stuff FROM atable FOR SYSTEM_TIME AS OF '2021-03-05') to retrieve it even if it looks to have been completely mangled or deleted if you use a non-time-travelling query.
- f38zf5vdt 5y agoSQL system versioned tables but with git hash tree versioning for every mutable command.