The Database as a Value
Rich Hickey
The Database as a Value Rich Hickey What is Datomic? A functional - - PowerPoint PPT Presentation
The Database as a Value Rich Hickey What is Datomic? A functional database A sound model of information, with time Provides database as a value to applications Bring declarative programming to applications Focus on reducing
Rich Hickey
magnitude, quantity, number... or immutable composite thereof
associate with a series of causally related values (states) over time
moment in time
v1 F v2 F v3 F v4
Process events (pure functions)
Observers/perception/memory
States (immutable values)
Identity (succession of states)
Process events (pure functions)
Observers/perception/memory Identity (succession of states)
DB Connection Transactions Queries
The Database Place
F F F
v1 F v2 F v3 F v4
Process events (pure functions)
Observers/perception/memory
States (immutable values)
Identity (succession of states)
DB Connection Transactions DB Values Queries
DB Process Novelty Computation Request fn(?) Result
DB Process Novelty Computation Request fn(?) Result
DB Process Novelty DB Values
DB Process Novelty DB Values
DB Process Novelty DB Values
DB Value fn(db) Result
DB Value fn(db) Result DB Value fn(db, db)
DB Value fn(db) Result DB Value DB Value fn(db, db)
//Peer Database db = connection.db().asOf(1000); Peer.q(aQuery, db); //Client GET /data/mem/test/1000/datoms?index=aevt
q(query, db1, db2, otherInputs ...); {:find [?customer ?product] :where [[?customer :shipAddress ?addr] [?addr :zip ?zip] [?product :product/weight ?weight] [?product :product/price ?price] [(Shipping/estimate ?zip ?weight) ?shipCost] [(<= ?price ?shipCost)]]}
[[:fred :likes "Pizza"] [:sally :likes "Ice cream"]]
cache Server Indexing Trans- actions Query App Process I/O App ORM? Caching policy? Strings DDL + DML Result Sets Serialized ??? Serialized ??? Disk
App Server Process Peer Lib Query Cache App Live Index Comm App Server Process Peer Lib Query Cache App Live Index Comm Transactor Indexing Trans- actions App Server Process Peer Lib Query Cache App Live Index Comm Transactor Indexing Trans- actions Data Segments Data Segments Redundant segment storage Storage Service Segment storage memcached cluster (optional) standby
Index Merging Trans- actions Log Data Segments Live Index Index Data Segments Storage Novelty
Live Index Storage Index Data Segments Novelty
(f db & args) -> tx-data
+ + + + foo
+ + + + bar
+ + +
+ + + +
Sorted Datoms Index Root
T 42 VeAET AEVT AVET Lucene EAVT dirs segs Index ref
EAVT t VeAET AEVT db atom nextT asOfT Lucene index history live Lucene sinceT index db value live Storage Hierarchical Cache Roots Memory index (live window) Storage-backed index