Datomic A modern database Databases Perks Declarative Query - - PowerPoint PPT Presentation

datomic
SMART_READER_LITE
LIVE PREVIEW

Datomic A modern database Databases Perks Declarative Query - - PowerPoint PPT Presentation

Datomic A modern database Databases Perks Declarative Query Language (e.g. SQL) Indexes Transactions (ACI) Durability (D) What are the Problems? Query as Strings Query Power "over there" Update in Place


slide-1
SLIDE 1

Datomic

A modern database

slide-2
SLIDE 2

Databases Perks

  • Declarative Query Language (e.g. SQL)
  • Indexes
  • Transactions (ACI)
  • Durability (D)
slide-3
SLIDE 3

What are the Problems?

  • Query as Strings
  • Query Power "over there"
  • Update in Place
  • Inflexibility in Data Modeling
  • Reaction by Polling.
slide-4
SLIDE 4

Datomic

  • Database by Rich Hickey, creator of Clojure.
  • Proposition to solve the preceding Problems.
  • ../ while retaining the Perks.
slide-5
SLIDE 5

Clojure Crash Course

  • Atomic Literals: Numbers, Strings, Keywords
  • Symbols and Definitions
  • Functions
  • Composite Literals: Vectors, Maps
  • Atoms and References
slide-6
SLIDE 6

State in Clojure

v1 v2 v3 v4

Observers Identity as succession of states F F F State as immutable value State transition as pure function

slide-7
SLIDE 7

State in Datomic

d1 d2 d3 d4

Observers Database as succession of states Tx Tx Tx State as immutable value Transations

slide-8
SLIDE 8

Architecture

App Comm Query Live Index Cache Indexing Trans- actions Transactor Peer Library Peer App Server Storage Service

slide-9
SLIDE 9

Facts

Entity Id Attribute Value Transaction 17592186049940 :artist/name "Mani Matter" 13194139538829 17592186049213 :artist/name "Walter Wegmüller" 13194139538101 17592186047069 :artist/name "Krokodil" 13194139535943 ;e a v t added? [17592186049940 94 "Mani Matter" 13194139538829 true] [17592186049213 94 "Walter Wegmüller" 13194139538101 true] [17592186047069 94 "Krokodil" 13194139535943 true]

slide-10
SLIDE 10

Entity

Entity Id Attribute Value Transaction 17592186049940 :db/id 17592186049940 13194139538829 17592186049940 :artist/name "Mani Matter" 13194139538829 17592186049940 :artist/type :artist.type/person 13194139538829 17592186049940 :artist/gender :artist.gender/male 13194139538829 17592186049940 :artist/startYear 1936 13194139538829 17592186049940 :artist/endYear 1972 13194139538829

slide-11
SLIDE 11

Entity

{:db/id 17592186049940
 :artist/name "Mani Matter"
 :artist/type :artist.type/person
 :artist/country :country/CH
 :artist/gender :artist.gender/male
 :artist/startYear 1936
 :artist/endYear 1972}

slide-12
SLIDE 12

Schema / Attribute

{:db/id 94
 :db/ident :artist/name
 :db/valueType :db.type/string
 :db/cardinality :db.cardinality/one
 :db/index true
 :db/doc "The artist's name"}

slide-13
SLIDE 13

Indexes (covering)

Type Ordering Usage Log Tx Order Log EAVT Entity Attribute Value Tx Search by entity AEVT Attribute Entity Value Tx Column Store AVET Attribute Value Entity Tx (optional) Search by value VAET Value Attribute Entity Tx (optional) Reference Navigation

slide-14
SLIDE 14

Queries: Datalog

[:find ?e
 :where [?e :artist/country :country/CH]] =? #|[17592186049940]
 [17592186047989]
 [17592186047069]
 [17592186049213]
 [17592186050318]
 [17592186046896]}

slide-15
SLIDE 15

Queries: Datalog

  • Data-Driven
  • Declarative
  • Unification
  • Many Features: Rules, Aggregate, Ranges, ../
slide-16
SLIDE 16

Entity API and Pull API

  • Entity API
  • Lazy
  • Navigable
  • Pull API
  • Declarative
  • Data-Driven
  • Hierarchical
slide-17
SLIDE 17

Transactions

Operation Entity Id Attribute Value :db/add 17592186049940 :artist/name "Mani Matter" :db/add 17592186049940 :artist/type :artist.type/person :db/add 17592186049940 :artist/gender :artist.gender/male :db/remove 17592186046681 :artist/name "Prince" :db/add 17592186046681 :artist/name "Ƭ ̵ ̬ ̊"

slide-18
SLIDE 18

Transactions

  • Data-Driven
  • Reified
  • Before/After Database Values
  • Subscription to Transaction Queue
slide-19
SLIDE 19

Caveats

  • Data Migration
  • Proprietary Software
slide-20
SLIDE 20

Resources

  • Datomic -. http:/0www.datomic.com
  • The Value of Values -. https:/0www.youtube.com/

watch?v=-6BsiVyC1kM

  • Deconstructing the Database -. https:/0

www.youtube.com/watch?v=Cym4TZwTCNU

  • ¿Where is my data? -. https:/0www.youtube.com/watch?

v=i3HDKNzZ5iw&index=6&list=PLZdCLR02grLoBx0Y5ZrpdmLx c160PIwzQ

  • Out of the Tar Pit; Moseley and Marks (2006)
slide-21
SLIDE 21

Thank you

@stanhbb http:/0www.meetup.com/zh-clj-Zurich-Clojure-User-Group/