Hypothetical scenario. The request reaches a catalogue worker, but Dev’s next box says only “product database.” Maya points to three screens: a promotion list, a category list and one product’s details. Each screen asks a different question of the same catalogue.
Dev: “Would choosing the database give us the next step?”
Priya: “First show which records each screen needs, in what order and with what limit.”
Build an access sheet that can constrain a storage choice. Preserve browsing-only scope while distinguishing a logical request, the records it returns and the work needed to locate them. The next page will compare models against this same sheet.
What does each screen ask the data to do?
An access pattern describes how an application locates and uses data. “Read products” is too broad to guide a design. “Read one product by stable identifier for a selected market and currency” identifies a selection and a representation. A category listing also needs membership, an order and a limit. A promotion page needs an eligibility rule and a way to identify the active promotion version.
For this hypothetical refinement of the earlier three reads per visit, choose one promotion listing, one category listing and one product detail request. This is an explicit selected mix, not an observation of real visitors. All three remain public catalogue reads. Checkout, reservation and money movement remain outside the scope.
Product identity should survive a display-name change. A name is a field that readers see; a key is an identity the application relies on. Market and currency may distinguish price records even where the underlying product identifier stays the same. State the full identity of the answer rather than assuming that one familiar-looking field is sufficient.
Write the read contract in ordinary language
The detail request selects one product and one applicable price representation. It returns the public fields required for display, a version and the evidence needed to evaluate price age. The category request returns an ordered first page of eligible products. The promotion request returns products eligible for one declared campaign version, with the same market and currency rules.
For the two listings, choose a page limit of twenty products for the worked example. Specify a stable tie-breaker where two products share a sort value. Otherwise two correct executions can disagree about which equally ranked product belongs at the page boundary. The later feed case will develop pagination under concurrent changes; here the immediate task is making the first page unambiguous.
Attach access paths to authoritative records
Hypothetical scenario. Introduce product Q7 and a market-price record keyed by product identity and market. A category listing is a query over membership and eligibility; it is not the authority that creates a price. Keep the initial read-only browsing scope while documenting which later command would own a price change.
| Record / key | Example fields | Question served |
|---|---|---|
| Product / product_id | Q7, description, source_revision | Detail identity |
| MarketPrice / product_id + market | Q7, UK, GBP, amount, evidence_time | Selected price |
| CategoryMembership / category + product_id | tools, Q7, sort_key | Ordered eligible candidates |
The same access sheet must distinguish a returned product appearance from a physical lookup. A category page asking for twenty eligible products needs both its predicate and ordering rule stated. Filtering after taking twenty candidates may return fewer than twenty eligible results. A selective predicate can change the plan; a row count alone cannot determine index usefulness.
Write the invariant beside the record that can enforce it. A unique product-market price row is different from a rule spanning several rows. If a future reservation grants an exclusive right, a fast listing or search projection may propose candidates but cannot grant the right. Two callers can read the same apparent availability before either changes it.
Translate visits into record work
Hypothetical worked example. Fifty visits in ten seconds gives 50 ÷ 10 = 5 visits per second. With one read of each kind per visit, promotion, category and detail each receive five requests per second. Total catalogue request rate is 5 + 5 + 5 = 15 per second, preserving the earlier busy interval.
If both listing requests return the selected twenty products and the detail request returns one, each visit receives 20 + 20 + 1 = 41 product appearances. Across the busy interval, that is 5 × 41 = 205 appearances per second. An appearance is a returned position, not necessarily a distinct product or a separate database operation.
An application that fetches each listed record separately could perform forty-one record fetches per visit in this simplified plan. A query that joins or batches the necessary records could organize the work differently. The access sheet should retain result cardinality while leaving physical execution open. Fifteen HTTP requests per second and 205 returned product positions describe different quantities.
The earlier 2,000-byte payload was a selected per-response accounting assumption. It has not been validated for these twenty-item listings. If Northwind keeps that payload allowance, a listing has at most 2,000 ÷ 20 = 100 bytes per item before any shared envelope, under an equal-allocation model. This reveals a requirement to check, rather than silently changing the network ledger.
State what must remain true during change
An invariant is a condition the system must preserve across permitted operations. Northwind needs one applicable price identity for a product, market, currency and selected version under its chosen representation rules. It must not join a price to the wrong product or present withdrawn promotion membership as current eligibility.
Describe writes even when the reader-facing feature is read-heavy. Who changes category membership? Who publishes a promotion version? Can price and eligibility change independently? Which operation establishes the record age used in the sixty-second rule? Omitting the write path hides the work required to keep read representations correct.
Do not assume every read needs one globally synchronized snapshot. A product description and a price may have different requirements. State which combinations are acceptable and which are misleading. The consistency and transaction modules later supply mechanisms for enforcing stronger contracts; the present lesson gives those mechanisms a concrete requirement to serve.
In the wild: a database can enforce declared rules
PostgreSQL’s constraints documentation describes primary keys, uniqueness and foreign keys. These are real tools for expressing selected identity and reference rules. They do not infer the correct business key from a field named “id,” nor establish that a price is recent enough for a particular delivery.
A useful model distinguishes what the database can enforce from what the application must observe or coordinate. A reference constraint can prevent a price record from pointing at a nonexistent product. It does not automatically decide which promotion version the visitor should see. Those are separate parts of the access contract.
When an omitted query controls the architecture
Hypothetical failure scenario. Northwind models only product detail, using a fast lookup by identifier. The category screen later needs the first twenty eligible products in order. With no supported category access path, the application retrieves many products and filters them after transfer. The detail benchmark remains fast while the listing path consumes the visitor deadline.
The error preceded the storage choice: a required access pattern was missing. Add the category selection, ordering and result-size contract, then evaluate an appropriate index or read representation. Do not treat a full scan as inevitable for every key-value design, or assume a relational label alone creates the missing access path.
Use the sheet to constrain the next choice
This method is useful when a product brief contains several screens or actions that appear to share one entity. It is less complete for an unknown analytical workload where future queries cannot all be listed. In that case, acknowledge the uncertainty and preserve flexibility rather than inventing a fixed query set.
Northwind now has three explicit reads, selected result sizes, stable identities and open write questions. The next lesson keeps this sheet unchanged while comparing storage models. The decision will be about representing relationships, serving selections and maintaining changes, rather than awarding one database family a general performance victory.
Challenge the proposed mechanism
Two readers see one available unit in a derived view. Which artifact is missing before either may reserve it?
Reveal the design reasoning
A conditional authoritative transition is missing. Document its read/write set and concurrency rule at the owner. Changing the query index can improve discovery but cannot serialize the two grants.
Decision and reconsideration: Keep an access-pattern and invariant-to-owner map together. Reconsider the aggregate boundary when a new command spans its records.
Find the missing contract
Does fifteen catalogue requests per second imply fifteen product records returned per second?
Retain result cardinality
No. In the selected mix, each visit returns forty-one appearances and five visits per second return 205 appearances. Returned positions, distinct records and physical database operations are different counts.
Can the earlier 2,000-byte payload be carried into twenty-item listings without inspection?
Expose the new constraint
It remains a selected assumption to validate. Equal division leaves one hundred bytes per item before an envelope. Required fields may not fit, which would require a recorded payload or representation revision.
A primary key guarantees a unique product row. Does it also prove promotion eligibility?
Separate identity from application meaning
No. Eligibility depends on the declared promotion version and membership rules. A uniqueness mechanism enforces its specified key, not an unstated product decision.
Northwind now has an access sheet instead of a generic database box. Page 12 holds those reads and changes steady while comparing relational, document and key-value representations.
Northwind decision log
Record promotion, category and detail selections separately, including ordering and limits.
Keep HTTP demand, returned appearances and physical record work as separate quantities.
Carry identities, relationships and change rules into the data-model comparison.
Go deeper: identity and data rules
- Book chapter: Database Design, second edition, chapter 5: Data Modelling — Adrienne Watt. Turn application questions into an explicit model.
- Book chapter: The same book, chapter 9: Integrity Rules and Constraints — Adrienne Watt and Nelson Eng. Distinguish identity and reference rules from application expectations.
- Video lecture: F2023 #01 — Relational Model & Algebra — Andy Pavlo / CMU Database Group. Build vocabulary for selections and relationships.
- Primary document: Constraints — PostgreSQL Global Development Group. Inspect the actual scope of key and reference enforcement.