Skip to content
academia.sh

Course Intermediate

Non-Relational Data Models

By the end of this course

Start course

01

Model Families

The five store families mapped to access pattern: key-value stores reached by a single key, document databases delivering a nested structure in a single read, wide-column stores offering write performance through the column-family model, graph databases making the relationship itself the subject of the query, time series stores whose layout follows timestamped measurement data, and the selection criteria on the path from access pattern to model.

  1. 01 Key-Value Stores The contract and cost of the simplest access model: the value's opacity to the store, measuring the same member page in the relational schema and the key-value model by round trips and records touched, the loss of the ability to query on a field and the application-maintained secondary index being read as a whole, and the trade-off key design sets up between write amplification and the number of read round trips.
  2. 02 Document Databases What a store that can see inside the value gains and what it costs: the combinatorial explosion of assembling a nested book record from four relational tables against reading it as a single document, the effect of an in-place field update on write amplification, and the load schema flexibility shifts onto the read side — the record count an indexed query silently misses and the document count a defensive read scans when three schema versions coexist in the same collection.
  3. 03 Wide-Column Stores The two-way cost of splitting layout by field: the page count the same data reads under row layout versus column-family layout, the range slice of a wide row that gathers thousands of columns under a single key, the partition key determining the access pattern and the write amplification of serving two patterns at once, and the effect of the append-only write path and the tombstone on space amplification and entries read.
  4. 04 Graph Databases The measured cost of making the link itself a record: the record count the same relationship query touches in the join table versus the adjacency list, whether that count grows with depth like a path count or like a node count, what step-by-step deduplication costs on the relational side, and the gain of two-ended traversal on the shortest-chain question when depth is not known in advance.
  5. 05 Time Series Stores The cost of storing timestamped measurement data under two layouts: the stored-byte difference between a full timestamp per row and a base timestamp per segment with delta coding and block compression, the segment and entry count a range query scans reversing as the range narrows, and a retention policy aligned to the segment boundary bringing entries touched down to zero.
  6. 06 Model Selection Criteria The criteria on the path from access pattern to family, and the number each criterion ties to: which family cheapens each of seven patterns and what guarantee is given up in return, scoring the same five workloads across five families, and the threshold at which the winner changes hands as the mix ratio shifts — one in a hundred thousand for traversal, one in five for a time range.

02

Working with the Document Model

The document model's everyday decisions: the consequences of the binary representation and its type system, the effect of the embed-or-reference decision on read and write paths, comparison, logical, and array operators, the aggregation pipeline that transforms and groups in stages, the choice among single-field, compound, and specialized indexes, the cost of adding a rule to a flexible schema, and the scope of multi-document transactions.

  1. 01 Document Data Types The byte cost of a document carrying its own field names and type tags: the space the same 20,000 book records take across open-named, short-named, and fixed-schema representations, the share that self-description accounts for, and the difference that writing the same field in two types produces in a range query.
  2. 02 Embedding and Referencing The same catalog's copies built in two schemas, embedded and referenced, and three tasks counted: the book page's round-trip count, the bytes the branch query reads, the bytes five thousand status changes write, and how many books hit the document size limit once loan history is embedded.
  3. 03 Query Operators The semantics of comparison, logical, and array operators are built in their own evaluator: a field path descending into an array, whether conditions are satisfied at the document level or the element level, what negation does on an array and on a missing field — each measured by the number of documents returned.
  4. 04 Aggregation Pipeline Staged transformation built in its own implementation, and the same question answered under three different stage orders: records processed rising from 43,610 to 124,606, a blocking stage's records held in memory rising from 2,418 to 40,276, and the result staying the same across all three orders.
  5. 05 Indexing Indexing built over the document's structure: how many entries a single document produces through an array field, combining two array fields into one compound index raising the entry count from 20,000 to 120,042, a condition that must be satisfied by the same element reading 6,033 documents through two single-field indexes versus 3,340 through an element-level index, and a partial index giving the same answer while taking up 5.5% of the collection instead of 27.4%.
  6. 06 Schema Validation Two measures of adding a rule to a flexible schema: a shallow rule catching two of four broken-document classes and missing two, the same rule placed on an already-full collection producing 3,900 violations across 3,200 documents, a backfill closing 3,000 violations by machine and leaving 900 to a decision, and 785 of 5,000 ordinary updates being rejected on the unfixed collection.
  7. 07 Transactions Counting where single-document atomicity is enough and where it is not: two concurrent loans for the same copy, run across all twenty step orderings, produce zero violations in the embedded scheme, twelve of the twenty orderings in the referenced scheme produce two open loans, and a multi-document transaction closes those twelve at a cost of eighteen aborts and a 637,044-byte rollback image.

03

Distributed Behavior

The decisions non-relational stores make in a distributed deployment: the primary-secondary topology and its election process, the imbalance risk in choosing a shard key, the acknowledgement-level settings of read and write concerns, how strong, eventual, and causal consistency show up in the application, stating the CAP and PACELC trade-offs correctly, and authentication, role modeling, and encryption configuration.

  1. 01 Replica Sets The document store's move beyond a single node: treating the primary-secondary topology not as replication mechanics but as the cluster's own election, translating the majority rule into a tolerated member loss that scales with cluster size, running the same failure across five cluster configurations and measuring whether an election happens, the number of turns without writes, and the number of rolled-back writes produced by the new primary's data gap, and showing how the candidate-selection rule can force a second election round.
  2. 02 Sharding Choosing the shard key from a document field: translating the key's presence-in-every-document and uniqueness requirements into an unroutable document count and an upper bound on shard count, measuring five candidate keys on the same twenty-thousand-document loan collection for placement balance and hot shards, counting how many shards the same query mix touches under each candidate, and showing how a compound key without a matching prefix scatters a query.
  3. 03 Read and Write Concerns Measuring the acknowledgement level as a setting: running the same loan scenario under three write concerns and counting ack turns, acknowledged writes, and the number of writes lost at the moment of failure, separating rolled-back writes from lost writes, showing how requiring acknowledgement from every member turns the loss of a single member into a write outage, and comparing unanswered requests, stale reads, and the number of reads that see data still to be rolled back across four combinations of read concern and read direction.
  4. 04 Consistency Models Translating combinations of settings into consistency models: measuring which read and write concern gives which model by running the same member session under six settings, separating the settings that preserve session guarantees using read-your-writes failures and monotonic-violation counts, defining causal consistency over two collections that sit on separate shards and counting reads where the causal link breaks, and translating each guarantee's cost into a number of turns waited.
  5. 05 CAP and PACELC Stating the trade-off correctly: running the same replica set under the same split across four settings and comparing rejected writes, rolled-back writes, unanswered reads, and stale reads, showing that a single setting can choose consistency on the write path and availability on the read path, measuring that a choice is made even when no split ever happens, in wait turns and a staleness window, and separating the structural bound that comes from cluster size from the decision that comes from the setting.
  6. 06 Security Configuration Measuring authorization as a setting: counting the collections and records reachable in a deployment with authentication turned off, running the same five application identities under cluster-wide, database-level, and collection-level roles and comparing the totals of readable, writable, and personal-data-carrying records, naming the residue that least privilege cannot shrink, and pulling out the cost of transport and at-rest encryption as extra bytes and an extra processing step.

Start typing to search.

↑↓ Esc navigate · open · close