Tune and integrate only where the workload evidence justifies it.

Choose Physical Layout, Materialization, Marts, Workload Isolation, and Cloud/Lakehouse Integration from Measurements

Choose AtlasMart physical layout, materialization, marts, workload isolation, and hybrid serving boundaries from measured evidence rather than folklore.

Intermediate → Advanced170–220 minutesbenchmark + architecture capstonematerialization + workload isolationLast reviewed: September 2026

Learning outcomes

01

Use a representative query corpus and equivalent results before changing physical design.

02

Interpret executed SQLite plans and p50/p95/p99 distributions with cache assumptions disclosed.

03

Choose an aggregate materialization because repeated workload evidence supports it, not because “aggregates are faster.”

04

Model noisy-neighbor isolation and distinguish a scheduler simulation from database concurrency measurement.

05

Carry governed semantics through marts and hybrid cloud/lakehouse serving boundaries while keeping cost assumptions explicit.

Capstone continuity: production meaning is frozen while operations are exercised

Chapter 30 begins from the accepted AtlasMart state produced by the earlier chapters: 10 paid order lines, 8 orders, 12 units, 820 USD gross revenue, 495 USD cost, and 325 USD gross profit. The accepted source waterline remains 208. The atomic sales grain remains one paid order line identified by (order_id, line_no); gross_revenue_usd.v1 remains the governed paid-line revenue metric in USD with UTC time semantics. CDC, defect, backfill, performance, security, and disaster-recovery exercises run against disposable copies and must reconcile back to this baseline.

Executed local harness and exact scope

The capstone evidence was executed with Python 3.13.5 and SQLite 3.46.1 on synthetic data in UTC. SQLite supplies relational constraints, transactions, indexes, query-plan evidence, and file backup/restore. It does not reproduce distributed shuffle, cloud IAM, managed row policies, autoscaling, object-store catalogs, multi-region DR, or provider billing. Those concepts are represented only as explicit policy fixtures, scheduler/cost calculations, or architecture decisions. No production credentials, personal data, paid services, or network dependencies are required.

1. Problem frame: performance claims are invalid if the result changes

AtlasMart’s executive BI workload repeatedly asks for seven-day revenue by product. A developer can make the query “instant” by changing filters, dropping dimensions, or querying stale precomputed data. That is not optimization of the same workload. The capstone therefore treats result equality as the first performance assertion and measures physical alternatives only after the semantic contract is fixed.

2. Representative corpus and scale fixture

The production teaching fact remains ten rows. To make scan behavior measurable without falsifying production controls, the harness creates a separate deterministic 120,000-row performance fixture by repeating the same column shapes across 60 synthetic dates. It is labeled benchmark data and is never reconciled as production revenue. The repeated BI query groups revenue by product for a seven-day range.

sql
SELECT product_id, SUM(revenue_usd)FROM fact_scaleWHERE order_date BETWEEN '2026-02-20' AND '2026-02-26'GROUP BY product_idORDER BY product_id;

Each benchmark path executes the same query semantics. Warm-cache runs follow five warmups; SQLite’s page cache is warm, while the host operating-system cache is not controlled. That limitation is part of the evidence, not hidden.

3. Before/after distributions: raw scan, indexed fact, materialized aggregate

Path Rows represented p50 ms p95 ms p99 ms Interpretation
fact_scale without date/product index 120,000 7.185 8.633 11.975 baseline local scan/group workload
indexed atomic fact 120,000 4.929 6.530 7.616 date-range search reduces local work; result unchanged
daily-product materialization 180 aggregate rows 0.009 0.010 0.018 far less input for this exact repeated workload

These values are the executed local results on this runtime, not universal tuning numbers. They can change with CPU, filesystem, SQLite build, cache, data distribution, concurrency, and query range. The meaningful capstone conclusion is narrower: for this fixture and query corpus, the materialized higher-grain table preserves the result and dramatically reduces local work.

4. Plan evidence shows access path, not business correctness

EXPLAIN QUERY PLAN
indexed atomic fact:SEARCH fact_scale USING INDEX idx_scale_date_product (order_date>? AND order_date<?)USE TEMP B-TREE FOR GROUP BYmaterialized daily-product:SEARCH agg_daily_product USING INDEX idx_agg_date_product (order_date>? AND order_date<?)USE TEMP B-TREE FOR GROUP BY

Both plans use date-range indexes and a temporary structure for grouping. The materialized table wins because it has only 180 day/product rows, not because the plan text promises universal superiority. SQLite also warns that EXPLAIN QUERY PLAN output is primarily interactive diagnostic information rather than a stable application API.

5. Materialization contract: acceleration must preserve lineage and freshness

The acceleration table is declared at one order-date × product grain with additive revenue, cost, and units. It is a derived product, not a replacement for the atomic fact. Its publication record must include source waterline/snapshot identity, refresh timestamp, metric version, owner, and reconciliation to the base fact for the refreshed scope.

Question Atomic fact Daily-product materialization
Can answer line-level audit? yes no
Can answer seven-day product revenue? yes yes
Write/refresh cost base ingestion only extra refresh/storage
Freshness as current as certified fact bounded by refresh
Rollback restore/replay fact route consumer back to fact and rebuild aggregate

A stale aggregate can be faster and wrong. Therefore latency, freshness, maintenance cost, and semantic coverage are one decision surface.

6. Marts remain dependent on conformed dimensions and governed metrics

Finance, marketing, and operations may each need domain-specific tables, but they do not get independent definitions of Customer or revenue. A wide reporting table can be a consumer convenience if its lineage and refresh contract remain explicit. It must not become an undocumented permanent API whose embedded filters drift from gross_revenue_usd.v1.

7. Workload isolation: distinguish simulation from engine measurement

The capstone includes a deterministic two-slot scheduler model to illustrate noisy neighbors. It is not a SQLite concurrency benchmark. With five long ELT jobs mixed into a shared two-slot pool, interactive query wait has p95/max of 1.0 second. With one logical slot reserved for interactive work and one for ELT, interactive p95/max wait is 0.0 seconds in the same synthetic arrival pattern.

Scheduler model Interactive p50 wait p95 wait max wait What it proves
shared pool, capacity 2 0.0 s 1.0 s 1.0 s long jobs can occupy capacity and delay interactive work in this model
isolated interactive/ELT pools 0.0 s 0.0 s 0.0 s isolation removes that modeled interference

Production engines expose different warehouses, queues, resource groups, reservations, slots, or concurrency controls. This simulation justifies a hypothesis; real deployment must measure the actual engine’s queueing, throughput, and cost.

8. Cloud/lakehouse integration: preserve system-of-record and serving ownership

Chapter 28 established that medallion layers and open table formats do not replace dimensional semantics. In the capstone, the operational ERP remains the business source; immutable/raw evidence supports replay; validated integration state may live in warehouse or lakehouse storage; the dimensional/semantic layer owns BI meaning; and materialization/federation decisions are explicit. A “one-copy” architecture is not automatically fresher, cheaper, or more governed.

Boundary Capstone rule Engine-specific decision left open
Object/open-table storage may preserve interoperable validated data Iceberg/Delta/Hudi support and transaction details
Dimensional serving must preserve fact grain and metric versions native tables vs external/open-table query
Federation allowed when latency/cost/consistency fit the consumer connector pushdown, remote scan, catalog behavior
Materialization allowed with freshness/reconciliation contract refresh mechanism and optimizer rewrite support

9. Cost model: explicit dimensions, fictional rates

The capstone teaching calculation uses 0.10 TB-month storage at 0.25 USD/TB-month, two compute units for three hours/day at 0.40 USD/unit-hour, 30 days, and 5 GB monthly egress at 0.05 USD/GB. The arithmetic yields 72.275 USD/month. These rates are deliberately fictional and exist only to make cost dimensions observable.

python
storage = 0.10 * 0.25compute = 2 * 3 * 0.40 * 30egress  = 5 * 0.05monthly = storage + compute + egressassert round(monthly, 3) == 72.275# Replace every rate with current region/contract/provider pricing in production.

Credits, slots, bytes scanned, compute seconds, storage, and egress are not interchangeable units. A valid cloud comparison maps the same workload into each provider’s current pricing semantics.

10. Controlled failure: cherry-pick the 0.009 ms result

Wrong approach

The team publishes “materialization is 700× faster” from one local p50 number, hides the cache state, ignores refresh/storage cost, and routes all workloads to the aggregate—including line-level audit queries it cannot answer.

Diagnosis: a workload-specific local measurement has been promoted into universal folklore. Coverage, freshness, p95/p99, maintenance, and correctness were dropped from the claim.

Repair: retain the complete benchmark distribution and query corpus, assert result equality, disclose cache/environment, declare supported grains, record refresh/cost, and keep an atomic fallback/rollback path.

11. Local lab: reproduce the performance evidence

python
# Separate benchmark fixture -- not production control dataassert fact_scale_rows == 120_000assert daily_product_rows == 180assert query(atomic_fact) == query(daily_product)# Executed warm-cache distributions on this machineraw_p50_ms = 7.185indexed_p50_ms = 4.929materialized_p50_ms = 0.009# Keep distributions, not averages onlyassert indexed_p95_ms == 6.530assert materialized_p99_ms == 0.018# Scheduler evidence is a model, not a DB measurementassert shared_pool_p95_wait_s == 1.0assert isolated_pool_p95_wait_s == 0.0

12. Verification checklist

  • Every physical/query alternative returns the same governed result for the same corpus.
  • Dataset size, engine/version, warmup/cache disclosure, and p50/p95/p99 are recorded.
  • Materialization grain, lineage, refresh timestamp, and rollback route are declared.
  • Domain marts consume conformed dimensions and governed metrics.
  • Workload-isolation numbers are labeled simulation unless measured in the target engine.
  • Cloud/lakehouse choices preserve system-of-record and serving ownership.
  • Cost dimensions and assumptions are explicit; fictional teaching rates are never presented as provider prices.

13. Production judgment and bridge to Lesson 4

The measured design now has a defensible reason for an aggregate, an explicit workload-isolation hypothesis, and a portable hybrid boundary. Production readiness still requires proving that these choices survive defects and incidents. Lesson 4 deliberately breaks data, metrics, access, historical materialization, and the primary database, then verifies repair, backfill, and recovery.

Knowledge check

Checkpoint

Why use a separate 120,000-row benchmark fixture?

Show answer

It makes performance effects measurable without pretending benchmark-scale totals are the governed production controls.

Checkpoint

What does the 0.009 ms p50 prove?

Show answer

Only that this materialized query path was faster for this local fixture/runtime/cache/workload while returning the same result; it is not a universal engine guarantee.

Checkpoint

Why keep the atomic fact after materializing daily-product totals?

Show answer

The aggregate cannot answer line-level audit or every future query and can become stale; the atomic fact remains the governed evidence base.

Checkpoint

Is the workload-isolation result a database benchmark?

Show answer

No. It is an explicit scheduler simulation used to illustrate queue interference and motivate measurement on the production engine.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only Ethereum or ERC-20 compatible assets to this address.