Pular para o conteúdo

Not Everything Is a Table

Este conteúdo não está disponível em sua língua ainda.

The question this module answers: How do you recognize when a document, key-value, wide-column, graph or time-series structure fits the job better than a table?

In chapter 2 we started a data model by listening for the nouns. In a relational database, those nouns become tables. In Salesforce, they become objects. And when you’re dealing with JSON or XML, they become structures: nested, hierarchical, all in one piece. Same nouns, different shapes.

Here’s the thing about tables: I can force almost anything into one. A JSON document? Break it into parent and child tables. GPS readings? Rows. A network of who’s connected to whom? More rows, and a lot of joins. With enough tables, keys and determination, I can represent nearly anything relationally. But being able to represent something doesn’t make it the right shape for the job. That’s the decision this module is about.

The easiest mistake in this area is starting with a product. “We’re going to use a graph database.” Why? “Because we have relationships.” That’s not enough. Salesforce has relationships. Every useful business system has relationships. Having relationships doesn’t mean you need a graph database. The same goes for “we have a lot of data, so we need NoSQL,” or “it’s JSON, so we need a document database.” Maybe. Maybe not.

So I start where module 1 left us, with what are you going to do with the data?, and I break it into the questions that actually decide the shape:

  • How will I find it? By its key? By any combination of fields? By time? By walking from one thing to the next?
  • How will it change? Edited all day, or added once and never touched again?
  • What do I read together? One whole item at once, or pieces from many places?
  • How much, and how fast? A thousand records, or millions of readings an hour?
  • Do the records share one shape? Or do they legitimately differ from one to the next?

Those answers point to a family of structures. Here are the five you should recognize, each on Steve Trucking.

Redrock sends its manifest through its API as JSON: the delivery, the Recipient, the address, the items, special handling notes, and a few nested sections only Redrock uses. Steve Trucking has a choice. It can break the whole thing apart into objects, fields and child records, or keep it as it came.

For the delivery itself, we break it apart: the Work Order, the line items, the partner key. The business runs on those. But the original payload, kept whole, is useful too: it’s what Redrock actually sent, it’s read as one piece when there’s a dispute, and its nested sections don’t all fit one model. A document store is built for that: a whole item, such as a JSON document, kept with its hierarchy intact and read as a unit, where two documents don’t have to have exactly the same fields.

Where does it live? In a document database, built to store and fetch whole documents by their identifier and still query the fields inside them, or, often enough, in a JSON column of a relational database that can do the same.

One word of caution, because “document” means two different things. Redrock’s manifest is a structured document: fields and nesting, written for a machine to read. A scanned bill of lading, a signed PDF or a delivery photo is a document in the everyday sense: a file, content a person reads or sees. Files don’t go in a document database. They live in file and object storage, or in Salesforce Files, and you fetch each one whole by its key or link, with metadata kept beside it so you can find it. That’s unstructured content, and it’s module 3’s subject.

That isn’t permission to stop modeling. I still need to know the document’s identity (here, the partner key), who owns it, which parts are authoritative, and which parts the business needs on their own. Module 3 is about exactly that line. For now: if you normally use the thing as a document, keeping it as a document is a design choice, not a failure to normalize it.

Key-Value: I Know the Key, Give Me the Value

Section titled “Key-Value: I Know the Key, Give Me the Value”

Now the simplest shape of all. The question is always the same: here’s a key, give me what goes with it.

Steve Trucking has two of these already. The Recipient’s tracking link carries a token; the page needs exactly one thing, the delivery that token points to. And the photos: each one sits in object storage under its key, and the Work Order’s index just holds the keys. Nobody searches the photo store by color or by the crew’s name. You hand it a key, it hands you the photo.

A key-value store is built for that question, and it’s very fast at it: caches, session information, preferences, the current state of something looked up by its identifier. Look to Salesforce first: Platform Cache is Salesforce’s own version of this idea, a layer for “caching Salesforce session and org data” where you “put, retrieve, or remove cache values” (Salesforce, Apex Developer Guide, Platform Cache (opens in a new tab), API version 68.0, checked 2026-11-28). You put a value in under a key and get it back by the same key.

Where does key-value data live for good? In a key-value database, built to survive restarts and to spread across many machines. Object storage is a key-value store too: the key is the object’s path and the value is the file, which is exactly why the photo store fits. A cache, Platform Cache included, is the fast copy in front, never the only one: a cached value can be evicted at any time, so the authoritative record lives somewhere permanent.

The simplicity is also the limit. If tomorrow someone asks “find every photo of a damaged washer at the Dallas DC last month,” a store that only knows keys can’t answer it. That’s the pattern: not “key-value is better than relational,” but key-value is very good when the question looks like key, then value.

One delivery, four structures One Steve Trucking delivery, four structures, each built for a different question. Rows: the Work Order, one row per Work Order and one per line item, each fact in one place, related by keys; built for find it any way, change it safely. A document: Redrock's manifest kept whole, one JSON document with the Recipient, address and items nested inside; built for read the whole thing at once. Key and value: the tracking token pointing to one delivery, and a photo key pointing to one image; built for here's the key, give me the value. Time-ordered readings: the truck's GPS, truck 142 at 10:14 with latitude and longitude, one a minute, added and never edited; built for what happened between 10:00 and 10:30. Underneath: the same delivery; the question decides the shape. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.52.0", "built": "2026-10-28", "id": "DGM-DA-BR-20", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "comparison 0.5.0", "theme": "stevetecharc 1.4.0"} Rows the Work Order LOOKS LIKE One row per Work Order, one per line item Each fact in one place, related by keys BUILT FOR Find it any way; change it safely A document Redrock's manifest, kept whole LOOKS LIKE One JSON document: the delivery, with the Recipient, address and items nested inside BUILT FOR Read the whole thing at once Key and value the tracking token, the photo key LOOKS LIKE token → one delivery photo key → one image BUILT FOR Here's the key; give me the value Time-ordered readings the truck's GPS LOOKS LIKE truck 142 · 10:14 · latitude · longitude One a minute, added, never edited BUILT FOR What happened between 10:00 and 10:30? The same delivery. The question decides the shape. © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Wide-Column: A Lot of Data, Shaped by How It’s Read

Section titled “Wide-Column: A Lot of Data, Shaped by How It’s Read”

The next family is the hardest to picture, so I’ll keep it to the shape. Wide-column stores are built for very large data spread across many machines, where each row can carry a large and varying set of columns, and where the design starts from how the data will be read.

Picture Steve Trucking’s fleet a few years from now, with engine and refrigeration sensors on the trucks. Different truck models report different measurements: one reports coolant temperature and tire pressure, another adds cargo temperature and door openings. Millions of readings, and the questions are always shaped the same way: everything for this truck, for this day.

Here the modeling question changes. In a relational design I ask, “where does each fact belong?”, and I can join my way to new questions later. In a wide-column design I ask, “what will I read together, at this scale?”, and I lay the data out for that, sometimes copying the same information on purpose so each read is one fetch. If you’ve spent your career treating normalization as the definition of good modeling, that feels wrong. It isn’t wrong. It’s a trade: I give up some flexibility to ask new questions later, in exchange for speed at a scale relational databases struggle with.

Where does it live? In a wide-column database spread across many machines, where each row is found by a key you choose (truck and day, for example) and the columns inside it are kept in order (by time). One table per question; a second question often means a second copy, laid out for that read.

Look to Salesforce first, and you’ll find the same discipline in big objects. You define a big object’s index when you create it, and you reach its records through that index. Salesforce is blunt about it: “After you’ve deployed a big object, you can’t edit or delete the index. To change the index, start over with a new big object.” The big objects database “stores billions of records and is a distributed system that favors consistency over availability” (Salesforce, Big Objects Implementation Guide: Define and Deploy Custom Big Objects (opens in a new tab) and Big Objects Best Practices (opens in a new tab), checked 2026-11-28). That’s design for the read: decide how you’ll find the data before you store the first record, because changing your mind means starting over.

Here’s a small one, built for this course. The index is two fields, the delivery key and then the time, newest first, and that’s the only way in. Look at the Index section at the bottom: the only action Salesforce offers is View.

Setup, Big Objects, Bench Delivery History, API name Bench_Delivery_History__b, Deployed. Custom Fields & Relationships: Delivery Key, Text(40), Indexed, index position 1, ASC; Event Time, Date/Time, Indexed, position 2, DESC; Status, Text(40), not indexed. Index: Bench_Delivery_History_Index, type Primary, with only a View action. Names and the day of the month are hidden.

A big object and its index: two fields, in order, and nothing to edit (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size

Graph: When the Relationship Is the Question

Section titled “Graph: When the Relationship Is the Question”

Now a different kind of question. Steve Trucking’s damage claims are up. Customer care asks: are they spread evenly, or do they cluster? Around one crew? One truck? One loading dock at one DC? One Retail Partner’s packaging?

Every one of those is a question about connections. A claim is about a delivery; the delivery was loaded at a DC, driven on a truck, delivered by a crew; the item came from a partner. The answer is in walking those connections, several steps out, and looking for the pattern. A graph stores things as nodes and the relationships between them as edges, with a type and a direction, so walking them is the main thing it’s built to do.

Could I answer this relationally? Yes, with a report and a lot of joins, for one pattern I already suspect. A graph is better when I don’t know how many steps away the pattern is, or which path it takes. So the test isn’t “do we have relationships?” It’s this: is the relationship itself what I’m trying to explore? If I just need the Contacts on an Account to run a sales process, an ordinary relationship is exactly right.

Where does it live? In a graph database, built to store nodes and edges and walk them quickly. Salesforce has no general-purpose graph store: relationships live as lookups, and a question like this one runs as reports and queries, or the connections are copied out to a graph store for exploring. One more case of one fact, many shapes.

There’s a second reason graph matters more now. Sometimes the relationship carries meaning the business needs. A delivery is for a Retail Partner; that partner is a subsidiary of a parent company; the parent signed a master agreement; the agreement sets the damage-credit rules; some rules apply only in certain states. Ask “which credit rules apply to this damage claim, in this state, for a delivery made for a subsidiary?” and the answer depends on walking a chain of meaningful relationships. The type and direction of each connection are part of the knowledge. So my rule has two parts: consider a graph when relationships and traversal are the question, and especially when the meaning of the relationships is part of the answer. We’ll come back to that meaning in module 5, at the semantic layer.

Are the claims clustering? Steve Trucking's damage claims as a network. On the left, three damage claims: C-48213, a dented washer; C-48377, a cracked TV screen; C-48410, a scratched range. Each is about a delivery: a Redrock delivery by crew 12 on truck 142, a Keystone delivery by crew 31 on truck 208, and a Brightwave delivery by crew 7 on truck 55. Each delivery was loaded at a dock. The Redrock and Keystone deliveries were both loaded at the Dallas DC, dock 4, highlighted: two claims lead there, through different partners, crews and trucks. The Brightwave delivery was loaded at the Phoenix DC, dock 2. Walking the connections finds the pattern no single record shows. Underneath: consider a graph when the relationship is the question. {"author": "Steve Simpson", "blueprint": "1.0.0", "builder": "standard 1.52.0", "built": "2026-10-28", "id": "DGM-DA-BR-21", "rights": "\u00a9 2026 Twinshark LLC. All rights reserved.", "template": "cells 0.4.0", "theme": "stevetecharc 1.4.0"} DAMAGE CLAIMS DELIVERIES WHERE THEY WERE LOADED Claim C-48213 a dented washer Claim C-48377 a cracked TV screen Claim C-48410 a scratched range A Redrock delivery crew 12, truck 142 A Keystone delivery crew 31, truck 208 A Brightwave delivery crew 7, truck 55 Dallas DC, dock 4 two claims lead here, through different partners, crews and trucks Phoenix DC, dock 2 one claim about about about loaded loaded loaded Consider a graph when the relationship is the question. HOW TO READ IT the pattern no single record shows © 2026 Twinshark LLC · stevetecharc.com
Click to enlarge

Time-Series: When Time Organizes Everything

Section titled “Time-Series: When Time Organizes Everything”

Module 1 already gave us the clearest example: FleetLink’s GPS, about 200,000 readings a day. Each one has a truck, a time, a latitude and a longitude. Perfectly respectable columns. But look at the questions: where was truck 142 between 10:00 and 10:30? How did its speed change on the route? What was the average time from the DC to the first stop over the last 90 days?

In every one, time isn’t just another field; it’s how I organize and find the data. That’s the clue for a time-series structure: measurements over time, arriving without end, added and never edited, read by time window, often summarized as they age (every reading for a week, then one per minute, then one per hour). IoT telemetry, application metrics, equipment sensors and GPS positions are all this shape.

Where does it live? In a time-series database, or in the IoT platform’s own store (FleetLink, for Steve Trucking), with older readings often moved to files in a data lake, organized by date (module 4). A relational database can store timestamped rows, of course. The question is whether the volume, the arrival pattern, the way old data is kept and the time-window questions make a time-series design the better fit. At Steve Trucking, Salesforce needs the truck’s latest position for the dispatcher and the tracking page. It doesn’t need 73 million readings a year as records.

Put it together for one delivery. The Work Order is rows in Salesforce. Redrock’s original manifest is a document. The tracking token is a key that points to the delivery. The truck’s GPS is a time series. And the claims network, if we build one, is a graph.

Which one is the real delivery? That’s the wrong question. The business thing is the delivery; each system holds the part of it that its job needs. What I care about is that I know, for each: where the authoritative facts come from, which representation may change them, how identity connects them (here, the partner key and the Work Order), how changes travel, how security and classification follow the data, and how long each one lives.

A Different Shape Isn’t Bad Normalization

Section titled “A Different Shape Isn’t Bad Normalization”

Here’s a distinction worth keeping straight. Backing off normalization (copying a value for a report, flattening an import object) is a decision inside the relational world: chapter 2 and module 1. Keeping a document as a document, a network as a graph, or readings as a time series isn’t “bad Third Normal Form.” They’re different models built for different questions. Architects sometimes grade every structure by relational rules. Don’t. Know relational modeling well enough to use it well, and know when you’re solving a different problem.

You’ll hear non-relational stores called “schema-less.” Be careful with that phrase. The data still has structure; the application that reads it expects certain fields. Identifiers still matter. Types still matter. Relationships still exist, even without foreign keys. Security, classification and retention still matter. And somebody still has to know what the data means.

Removing the rigid schema doesn’t remove the architecture. It moves it: out of the database, where Salesforce or a relational engine would have enforced it, and into your design, your code and your documentation. That’s more responsibility for the architect, not less.

  • The questions first: how the data is found, changed, read together, how much arrives, and whether records share one shape.
  • Which family fits each job: rows, documents, key and value, wide-column, graph or time-series.
  • Whether a relationship is the question, and whether its meaning is part of the answer.
  • How identity ties every shape back to the same business thing.
  • Where the structure, rules and security live once the database no longer enforces them.

Beyond the exam: agents read every shape you give them access to: documents, caches, event histories, graphs. A graph of meaningful relationships can help an agent answer questions a table can’t, and a document full of nested details can hand it more than its job needs. Choose the shape for the job, and decide what each consumer may read from it (chapter 12).