Course contents
On this page
Lesson 42 of 59

A purchase and a yearly report need different work

Compare selective updates with large aggregations before choosing an engine design.

The shop asks its database to do two jobs. Checkout changes stock for one product and records one order. A yearly report reads millions of orders and totals revenue by month. Both want a quick answer, but “quick” refers to very different work.

A transactional workload usually consists of relatively small operations over selected current records. An analytical workload often scans and combines many records to answer a broader question. These are useful descriptions, not strict categories that every query must fit.

Compare the data each request needs

Imagine a table with ten equally sized columns. Checkout needs one selected row. The report needs two columns across all rows: date and paid amount.

Purchase
Locate a small set of rows
Check a rule
Commit related changes

Yearly report
Read dates and amounts across many rows
Group by month
Sum each group's amounts

A small result is not necessarily a small computation. Twelve monthly totals can require examining a year's orders.

A row-oriented layout keeps a row’s fields near one another. A column-oriented layout groups values from the same column. Under our equal-width simplification, reading two of ten columns touches 20% of the raw column payload instead of all ten columns. That does not establish a fivefold speedup: compression, decoding, filtering, aggregation, and output also cost work.

Conversely, finding and modifying several fields of one row may fit a row-oriented access path naturally. A columnar engine may use additional structures or batching to handle updates. Physical organization responds to the operation, not just the data’s topic.

Current interaction adds another requirement

A live dashboard also wants to hear when an order changes. That introduces a delivery requirement after the database update: which clients receive which changes, in what order, and how they catch up after disconnecting. The later real-time lesson treats it separately from storage layout.

Systems such as ClickHouse, Convex, and SpacetimeDB package different combinations of analytical execution, application logic, and reactive delivery. Their detailed comparisons remain in the reference. The core skill is to identify the required work before comparing product packaging.

Combine the workloads carefully

A report’s long scan evicts frequently used product pages and increases checkout latency. Does that show the checkout query suddenly needs a different result?

Separate semantics from resource interference

No. Its required result is unchanged. The report is competing for memory or I/O. Possible responses include workload isolation, scheduling limits, a suitable secondary representation, or a separate reporting system. Each adds maintenance and freshness responsibilities that must be evaluated.

We now have a local engine and a way to reason about its workload. The next stage adds communication between machines, where failures can leave callers uncertain about whether an operation completed.

CMU’s storage-model lecture provides further study of row and column organization. The numerical comparison is a teaching model, not a benchmark of a named system.

Extended reference

The extended chapter preserves the original technical coverage, additional examples, and citations. The explanation above supplies the concepts needed for this page; the reference develops the specialist cases.

Find a section from the original chapter