3 ms·
Append-only means that every fact is timestamped and nothing is ever thrown away. (Actually, Datomic provides excision, because some regulatory use cases requir
by michaelochurch 12y ago
Append-only means that every fact is timestamped and nothing is ever thrown away. (Actually, Datomic provides excision, because some regulatory use cases require it, but it's a "black magic" feature.) The idea is that you should never use UPDATE or DELETE, unless it's a hard requirement or a well-studied optimization. The fact that it's 58 degrees today doesn't invalidate the fact that it was 45 degrees yesterday. New facts may replace old ones relative to time-sensitive queries ("what is the most recent temperature?") but you never get rid of the old ones.
This means that queries often have an additional parameter, which is the time. So a type signature for a query type (in a Haskell-like language) would be:
type Query a = ([Fact], Time) -> a
where the typical use case would use all stored facts and the current time. (Obviously, the DB itself isn't going to do a full-table scan for typical queries. There are optimizations involved. But, conceptually, a query is a function over all facts.)
- dllthomas 12y agoI've actually recently been thinking of extending this logic to my Anki geography deck. Populations change, but population at some specific point in time shouldn't.