SIMULATED

Cost Optimization Lab

Two queries over the same dataset, doing wildly different amounts of work. Find the driver — and notice that the thing which looks expensive is rarely the thing worth fixing, because the expensive-looking thing is usually the one somebody already thought about.

SIMULATEDEverything numeric on this page

Everything on this page is expressed as relative work — bytes read against bytes that had to be read, one query against another. There are no prices anywhere in this domain, on purpose: a price is a fact about somebody else's contract in some other year, and memorising one is how you end up optimising the driver that was not moving.

Data platforms do not get expensive by a decision. They get expensive quietly, one dashboard refresh and one full rebuild at a time, and the bill arrives attributed to nothing. The first useful move is almost never an optimisation — it is attribution, because a shared platform makes every cost everyone's and therefore nobody's.

Then look at the drivers below in order. In most platforms one of the first two accounts for the majority of the movement, and both respond to layout changes that take an afternoon.

The lab

Compare two queries over the same data and account for the difference. The answer is always in what the reader was obliged to touch.

Cost lab — the metered dimensions

Change one thing at a time: the predicate, the columns selected, the partition key, the file size. Watch which change moves the work and which changes only move your confidence.

Cost lab — the metered dimensions
Data platforms are billed on bytes scanned, requests made, and time a cluster was awake. This lab moves the first two and shows nothing in currency.
Layout
Bytes scanned / query
36.4 MBsim
Bytes scanned / day
7.1 GBsim
Requests / day
19Ksim
Against the tidy layout
19xsim
Bytes scanned per day, against a date-partitioned, compacted, narrowly-projected read18.7x
Metered dimensionThis layoutMoved by
Bytes scanned7.1 GBsim/dayPartition pruning and column projection, multiplied together. `SELECT *` alone defeats the cheaper of the two.
Requests19Ksim/dayFile count. A partition written 96 times holds 96 objects until something compacts them, and every one is listed and opened.
Cluster timenot modelledOwned by Observability & Performance. A second latency model here would disagree with that one, and one of the two would be wrong on any given page.
SELECT * defeats column pruning entirely, which is the single cheapest optimisation a columnar format offers.
Each partition is written 96 times, so it holds 96 files where 1 would do. Compaction rewrites them into fewer, larger files — at the cost of the rewrite itself.
The largest cost reduction available to most platforms is not a cheaper engine. It is a layout that lets the engine skip, and a query that does not ask for columns nobody reads.
SIMULATEDCLOUD-SPECIFICWhich dimensions are metered, and at what rate, differs by provider and by product. What transfers is that a layout decision moves a metered quantity by orders of magnitude — so this lab reports the quantities and never a price.

The five drivers

Everything a data platform charges for reduces to one of these. Naming which one moved is the entire diagnosis.

1
Bytes scanned

How much of a dataset a query is obliged to read in order to answer.

What moves it
Partition pruning that actually applies, column projection, and file layout. This is the driver that responds most to the least work, and the one most often left alone.
2
Bytes shuffled

How much data crosses the network between tasks because a key required it.

What moves it
Filtering and projecting before the exchange rather than after, broadcasting small sides of joins, and pre-bucketing on the join key.
3
Bytes retained

Everything held, in every copy, for as long as it is held — raw, modelled, extracted, and the copies nobody remembers making.

What moves it
A lifecycle policy, argued as a recovery-window and liability decision rather than a cost one. Retention that is only a cost decision gets set too short and is discovered during an incident.
4
Compute held

Resources reserved rather than resources used — a cluster that is up, a warehouse that has not suspended, a job that holds capacity while it waits on something else.

What moves it
Right-sizing, auto-suspension, and noticing that a job spending most of its life waiting is holding everything it acquired for that whole time.
5
Work repeated

The same computation performed again over data that has not changed.

What moves it
Incremental processing instead of full rebuilds, and a dashboard refresh interval set to something a human actually reads rather than to the smallest number the tool allows.

The moves that look like savings and are not

Each of these reduces something. None of them reduces the driver that was actually moving.

Familiar false economies
  • Moving to a colder storage tier when the driver was scan volume. Storage was never the problem, and retrieval from the cold tier adds a charge of its own.
  • Shrinking the cluster when the job is bound by one skewed task. The runtime does not move; the job simply holds fewer resources for the same wall-clock time.
  • Deleting raw history to save storage, which converts every future bug from a re-run into an unrecoverable loss.
  • Compressing harder on a workload already bound by CPU, which makes the query slower and the storage line smaller.
  • Aggregating a table so nobody can query it expensively — which works, right up until somebody needs the detail that was thrown away.