3 cs341 FS26 NoSQL
3 cs341 FS26 NoSQL
[Link]
Source: [Link]
Source: [Link]
Simple interface
− No full-fledged declarative query language
− No joins
Relaxed consistency
− No ACID
− (BASE)
Distributed Information Systems – Spring 2026 – NoSQL 5
Objectives of Chapter 3
− Wide-Column Stores
▪ Data is organized into column families with flexible schema
− Document Stores
▪ Structure of data is specified via XML or JSON
− Graph Stores
▪ Systems tailored to graph structures (nodes, edges) and graph algorithms
The terms store and database are often used interchangeably, but the difference usually comes down
to emphasis and context.
“Store” tends to highlight the system's role in persisting data, especially in specialized or simplified
systems that focus on particular access patterns
In the NoSQL world, many systems are referred to as stores to stress their optimized, schema-flexible
nature, even though they provide many of the functions typically associated with databases.
Key Value
K1 42 2016-02-29 105.71
K2 'Miller'
K4 7 5 'ID' 5
− etc.
Customers
− Relational databases use “Row
ID Name City Balance Discount
Stores”
01 Legrand Geneva -1‘080,00 0.10
Database 02 Marty Basel -8‘00,00 0.20
Single attributes can be stored several times in the read-optimized store (in different projections)
− For each projection, there is a Sort Key (the attribute according to which the projection is sorted)
− Each projection is horizontally partitioned into several segments.
− Each segment is characterized by a Segment Identifier (SID).
This means that each segments encompasses an interval of the Sort Key.
Logical Physical Projection P1 Sort key
representation representation
SID Name Dept
1
Table Employees
Segments
Name Age Dept Salary
2 Key range
Sort key Sort key
3
P2 Name Salary P3
Age Salary
− The entries (or values) of each segment are characterized by a Storage Key (SK)
− The link to other attributes of the same tuple is done via specialized Join Indexes
− Assumption: P1 (M segments) and P2 (N segments) are projections of the same relation (table)
▪ A Join Index then consists of M tables (one per segment of P1)
▪ An entry in the Join Index of P1 for segment SP1 contains for each entry of SP1 a link to the
corresponding entries in projection P2
▪ This link consists of the segment identifier (SID) and the Storage Key (SK) within the segment
▪ Join Indexes thus only establish a unidirectional link between projections
…
Segment SP1,i: ith segment of Projection P1 SP2,j
Name Salary
SP1,i Name SK Dept
1
2
3
4
5
…
SP2,j+2
Name Salary
Join Index for Segment SP1,i
SID SK
… …
… …
… …
SP2, j 3
…
SP2, j+2 1
Keys Columns
Each row can have a varying set of
columns
Phone Mail
Alice
+41 71 .. alice@gm..
Similar to column stores, data is
stored column-oriented Mail Address Fax
Bob
alice@gm.. Weg 1 +41 61 2 ..
Address Fax
Olivia
Weg 5 +41 63 5 ..
BigTable, a wide-column store, is a distributed storage system for managing structured data that is
designed to scale to a very large size (up to petabytes) across thousands of commodity servers
− Developed by Google and used by over sixty of their products and projects (Web Indexing, Google
Earth, Google Finance, Personalized Search)
Rows:
− Each row identified by a row key
Columns:
− Column family: column name which might appear multiple times in a row
− Column key: combination of column family and qualifier
Multiple versions:
− Under a column key, several versions of the associated value (enriched with a timestamp that
indicates their validity) can be stored
− Materialize the evolution of the value over time
Column Family
… … … … … … …
<html>.. T2 … …
<html>.. T3
<html>.. T4
<html>.. T5
…
…
… … … … … … …
Timestamps
value
Distributed Information Systems – Spring 2026 – NoSQL 26
… Google BigTable
Internet of Things (IoT) Data: High-velocity, large-scale sensor and telemetry data
Large-Scale Logging & Event Tracking: High-volume logs and monitoring data
Apache Cassandra (originated at Facebook): combines key/value stores and more sophisticated
schemas, [Link]
From a conceptual point of view, document databases are in between relational DBMS and key/value
stores
− Each record (= document) is associated with a unique key
− In contrast to a key/value-store, the value (document) has an inherent structure which is specified
either via JSON or XML
− JSON or XML documents can be nested
In contrast to key/value stores, document stores also provide an API or query language that allow to
retrieve documents based on their content (and structure)
− Example: select all documents where a particular object has a given value
− These APIs or query languages are proprietary and depend on the type of documents
(and their representation) supported
A graph is called
− Directed graph if it contains only directed edges
− Undirected graph if it contains only undirected edges
− Multigraph if it may contain several edges between the same two nodes
− Complete if it contains all possible edges
Two nodes are called adjacent if they are connected via an edge; an edge is incident to a node
if it is connected to that node
Examples of graphs …
… Examples of graphs …
Undirected Multigraph
v2
− Each edge is represented by a set including two nodes e1 e2
e3
v1 v3
− The edge set E is a multiset of such edges
e4
Directed Multigraph
v2
• The edge set E is a multiset of tuples e1 e2
e3
v1 v3
e4
e5
… Examples of graphs
Weighted Graphs
− Each edge ei has an associated weight wi
(e.g., cost, distance, capacity, etc.)
e1: w1 v2 e : w
2 2
− Edge weights are independent of the type of graph v1
e3: w3
v3
(directed / undirected) and the multiplicity of edges e4: w4
− Eulerian path
▪ Traverse a graph by visiting each edge exactly once
▪ Start node and end node do not need to be the same
− Eulerian cycle
▪ Each edge has to be traversed exactly once
▪ Start node and end node are the same
− Hamiltonian path
▪ Each node has to be visited exactly once
(not all edges have to be traversed)
− Hamiltonian cycle
▪ Each node has to be visited exactly once
(start and end node are the same)
− Spanning Tree
▪ Find a subset of the edges of E (from a start node = root)
that forms a tree and that visits each node
− Shortest path
▪ Minimal number of edges between two nodes
(alternative: minimal weight on path from start to end node)
− Advantages v1 -1 0 -1 1
v2 1 1 0 0
▪ Only existing edges are stored (no empty column) v3 0 -1 1 -1
− Disadvantages
▪ Insertion of nodes / edges costly (extension of matrix)
▪ Search for neighbors requires costly scans
▪ Large storage overhead
Distributed Information Systems – Spring 2026 – NoSQL 50
Self-Study
− Stores vertex set V and for each vi ∈ V, a linked list that contains
the neighbors of vi (adjacent nodes)
v2
▪ For directed graphs, the list only contains nodes connected e1 e2
e3
via outgoing edges v1 v3
e4
▪ For multigraphs, nodes may occur several times in a linked list
e5
− Advantages
v1 v2 v3
▪ Insertion of vertices and edges v2
▪ Lookup of neighbors v3 v2 v1 v1
− Disadvantages
▪ Checking existence of particular edge
(especially for a given target node)
− Stores vertex set V and for each vi ∈ V, a linked list that contains
all the incident edges of vi
e1 v2 e2
▪ For directed graphs, only outgoing edges e3
are stored in the incident list v1 v3
e4
− Advantages
▪ Insertion of vertices and edges v1 e1: v2 e3: v3 e4: v3
▪ Lookup of neighbors v2 e1: v1 e2: v3
v3 e2: v2 e3: v1 e4: v1
− Disadvantages
▪ Checking existence of particular edge for a given target node
ID: 4 ID: 8
Label: knows Label: knows
since: 2009-08-07 ID: 5
Label: knows since: 2017-03-28
since: 2009-08-07
Neo4J ([Link]
− Based on Labeled Property Graph Model
− Edges are called “relationships”
− Provides ACID transactions
− Indexing for node and edge properties based on the Apache Lucene text search engine library
− Declarative query language Cypher (search for nodes or traverse a graph)
“Mimick” elements of the data model in the query language (“ASCII art”)
− --> and <-- are used for directed edges (anonymous relationships)
− -- is used for undirected relationships (in the DB, a direction must be specified;
the -- edges are only used for query purposes “don’t care”)
− Relationship names and/or types are inserted in [] in between the relationship arrow;
for instance –[:likes]-> refers to the :likes relationship between two nodes
− Examples:
▪ Node property: (p:Person {name: 'Alice'})
▪ Relationship property: -[rel:IS_FRIENDS_WITH {since: 2018}]->
Cypher queries have a dedicated structure given. The most important clauses are:
MATCH
▪ specifies an existing node, relationship, label, property, or pattern in the database
▪ It corresponds to a graph traversal to be considered in the query
▪ It can be compared to the SELECT clause in SQL
WHERE
▪ (optional) specifies additional filters
RETURN
▪ specifies the values or results (nodes/relationships/properties/patterns) a query should return
▪ It is not required for write operations but it is needed for reads
− Neo4j ([Link]
− HyperGraphDB ([Link]
▪ Supports hypergraphs
− OrientDB ([Link]
▪ Combined document database and graph database
− The Resource Description Framework (RDF) provides a simple language to capture knowledge
▪ In short: the purpose of RDF is to provide the mechanisms to specify data “about” something,
i.e., about arbitrary resources
▪ Self-descriptive data
predicate(subject, object)
Subject Object_A
Predicate_1
Object_B
Predicate_2
− Resources: phil101
Immanuel Kant
…
− Literals: 'Critique of Pure Reason'
‘Königsberg’
…
− Statements: hasTitle(phil101, 'Critique of Pure Reason')
teaches(Immanuel Kant, phil101)
bornIn(Immanuel Kant, ‘Königsberg’)
…
RDF Property Graph
− Resources: phil101
Immanuel Kant
…
− Literals: 'Critique of Pure Reason'
‘Königsberg’
…
− Statements: hasTitle(phil101, 'Critique of Pure Reason')
teaches(Immanuel Kant, phil101)
bornIn(Immanuel Kant, ‘Königsberg’)
…
RDF bornIn Property Graph
Immanuel
Königsberg
Kant
teaches
phil101 Critique of
hasTitle Pure Reason
− Resources: phil101
Immanuel Kant
…
− Literals: 'Critique of Pure Reason'
‘Königsberg’
…
− Statements: hasTitle(phil101, 'Critique of Pure Reason')
teaches(Immanuel Kant, phil101)
bornIn(Immanuel Kant, ‘Königsberg’)
…
RDF bornIn Property Graph
Immanuel
Königsberg Person
Kant Course
teaches name:
“Immanuel Kant”
teaches courseId: phil101
− A triple store is a dedicated (graph) database that only supports RDF triples
▪ There are native triple stores …
▪ … and triple stores built upon relational databases, graph databases, or document databases
− If triples are named (named triples), systems are called quad stores
− With the advent of graph databases, triple stores have lost their importance
Database servers with large-scale main memory can keep an entire database in transient memory
− Hence, main memory is the primary storage location for data
− The performance (read and write) is significantly higher than in databases with persistent storage on
HDDs or SSDs.
− A, C, and I of ACID can be provided without problems
− But: durability (D) cannot be provided without additional mechanisms
In-memory data management is orthogonal to all database types that have been introduced
before:
− Can be applied to relational systems as well as to all other forms of NoSQL databases
− Typically, systems are hybrid: they can operate only in main memory or they are able to store
data on disk
In order to make sure that in-memory databases survive system crashes, they need to support one of
the following:
− Snapshots: the system periodically stores a snapshot of the entire database. After a system crash,
all changes since the last snapshot will be lost.
− Logging: transaction logs are stored persistently on disk (either based on an initial system state or
in combination with periodical snapshots). During recovery, the log has to be re-played.
− Replication: the in-memory database is replicated to other in-memory servers
Polyglot programming
− Applications can be written in different programming languages
− Each language is used for an aspect for which it is particularly well suited
→ This has advantages compared to a solution based on only one language
Polyglot persistence
− Adoption of the polyglot programming concept for databases
− Instead of a “One-Size-Fits-All” database for an entire application, polyglot persistence considers
a combination of different databases (data models / storage technologies / query language)
→ Select the best data management solution for a certain (sub-)set of an application’s data
Multistore database
− Provides a common user interface and a common query language on top of heterogeneous
database systems
No One-Size-Fits-All
− There is not a single system that jointly supports all types of applications
− Even for concrete applications, it is sometimes impossible to select a database / storage system
− Combine polyglot persistence and multistores (i.e., combine different databases in one system)
− Different storage technologies (main memory, SSD, spinning disk)
− Data replication (in different data formats / models)
− Decision per query where to route a request
− Logical database consisting of several physical databases
Polystore
− Polypheny: research prototype and commercial product emerging from the DBIS group of the
University of Basel ([Link]
− BigDAWG ([Link]
− … and others
PolyDBMS
− Data can be placed on a heterogenous set of data
stores
Physical Schema
− Building blocks are defined by the data store
− Storing data for efficient querying
− Utilizing features of the data store
Logical Schema
− The central schema of the PolyDBMS
− Building blocks from all supported data
models
− Enabling cross-model queries
Physical Schema
− Building blocks are defined by the data store
− Storing data for efficient querying
− Utilizing features of the data store
𝑆 ∶= 𝑁1 , 𝑁2 , … , 𝑁𝑚 with 𝑚 ∈ ℕ
<c u s t o m e r >
Map node labels as tables and mimic id: 96
the concept of join tables name: Alice
address:
Hölstein
<c u s t o m e r, vip
vip> <k n o w s>
id properties labels
id: 55
55 name: Hanna, address: Basel customer, vip
name: Hanna
address: Basel <c u s t o m e r > customer->customer
id: 285 src tgt properties labels
name: Bob
55 285 knows
<k n o w s > address: Liestal
96 55 knows
customer->vip
<c u s t o m e r >
id: 96 src tgt properties labels
𝑁 𝐿𝑃𝐺 ≔ name, 𝐺
𝑁 𝑅𝐸𝐿 ≔ name, 𝑇1 , … , 𝑇𝑛 with 𝑛 ∈ ℕ
𝑁 𝐿𝑃𝐺 ⟼ 𝑁 𝑅𝐸𝐿
010110101001010100101110101101
Availability
− For the client, the system (even though it might be distributed) looks
like one physical system and should be usable / accessible anytime
− Solution: redundancy & replication
Consistency
− The more replicas, the more difficult to keep consistency
− When enforcing consistency, the system is no longer highly available
Distributed Information Systems – Spring 2026 – NoSQL 105
CAP Theorem …
− Only two of the three requirements Consistency, Availability, tolerance to network Partitions
can be met at the same time (has been formally proven)
Consistency Availability
− Cloud providers can choose to either weaken
− Availability, or
− Consistency
Network
partitioning
tolerance
If there is
[Link]
no partition
Consistency Availability
impos-
sible
x = 42 x? 42 no Partition no
availability Tolerance consistency
− Systems with an exclusive focus on fault-tolerance: N=3, with W=2 and R=2
− Systems that aim at providing a high degree of fault-tolerance, but not consistency:
N=3, W=1 (master node), and rely on a lazy technique to update the other replicas
Sequential Consistency
− This corresponds to the serializability criterion in databases (conflict-preserving serializability,
CPSR), i.e., the equivalence to some serial execution
→ highest form of consistency
Causal Consistency
− Writes that are causally related must be seen in the same order.
− At the same time, writes (especially from the same transaction) that are not causally related may be
executed in different orders on different sites
Read-your-Write Consistency
− A system guarantees that, once a record has been updated, any attempt to read the record
will return the updated value
Writes-follows-reads Consistency
− A write operation on object x following a read on x by the same transaction is guaranteed to take
place on the same or more recent version of x that was read
Session Consistency
− Read-your-Write consistency, where the property is only limited to the lifetime of a client session
Most Cloud providers rather provide much softer and blurrier guarantees (because of the CAP
theorem): BASE
− Basically Available: the system is available most of the time, but may occasionally be down
− Soft state: information (state) the user puts into a system will eventually go away if this information
is not maintained (i.e., information will expire unless it is refreshed) – in contrast to the D in ACID
− Eventual consistency: weak consistency, see before; – in contrast to the I in ACID
• availability
• performance
• inconsistency costs • consistency costs
Latency matters!
− Amazon found every 100ms of latency cost them 1% in sales
− Google found an extra 0.5 seconds in search page generation time dropped traffic by 20%
− A broker could lose $4 million in revenues per millisecond if their electronic trading platform is
5 milliseconds behind the competition
[Aba 12] Daniel Abadi: Consistency Tradeoffs in Modern Distributed Database System Design:
CAP is Only Part of the Story. IEEE Computer 45(2): 37-42, 2012.
[AFG+ 09] M. Armbrust, A. Fox, R. Griffith, A. Joseph, R. Katz, A. Konwinski, G. Lee, D. Patterson, A. Rabkin,
I. Stoica, M. Zaharia. Above the Clouds: A Berkeley View of Cloud Computing. Tech. Report UC
Berkeley, 2009.
[Bre 00] E. Brewer: Towards robust distributed systems. In: Proc. PODC 2000.
[EFH+ 11] S. Edlich, A. Friedland, J. Hampe, B. Brauer, M. Brückner: NoSQL – Einstieg in die Welt
nichtrelationaler Web 2.0 Datenbanken. Hanser, 2011.
[GL 02] S. Gilbert, N. Lynch: Brewer's conjecture and the feasibility of consistent, available, partition-tolerant
web services. SIGACT News 33(2): 51-59, 2002