Skip to content
dbexplore

Cost

Unit economics for a database

For anyone asked whether a rising database bill is a problem, when the honest answer depends on how much the business did with it.

How to turn database spend into a unit cost: choosing the unit, dividing attributed cost by it, why total and unit cost diverge, and what makes a unit bad.

Reference page, revised in place. Last updated .

A bigger bill is not yet a verdict

The database bill rose by a quarter this month. Engineering says traffic rose by half. Finance says the budget was exceeded. Both statements are about the total, and the total cannot settle the argument, because it says how much was spent and nothing about what the spending bought.

Unit economics is the discipline of answering the second question. It divides cost by something the business counts, so that a bill that grew with the business and a bill that grew on its own look different.

Definitions first

Unit cost is attributed cost divided by units of a driver, measured over the same window. Each half needs a definition.

Attributed cost is the part of the database bill assigned to the thing being measured: an application, a team, a customer tier. It is an allocation, so it carries the certainty of the method that produced it, and a ratio built on modeled costs is itself modeled. The cost model guide sets out the bases a cost figure can rest on.

A unit is a count of work or of value, and three families cover most choices.

  • Activity units count work done: a thousand calls, a thousand transactions, an order placed.
  • Volume units count what is kept: a gigabyte stored, a million rows retained.
  • Customer units count who is served: an active customer, a tenant, a seat.

The same database can honestly carry several. A search service might report cost per thousand queries for the team that owns latency, and cost per gigabyte kept for the team that owns retention.

Worked example

The figures are invented. In a baseline month a service’s attributed database cost is $12,000 and the service handles 40 million calls, which is 40,000 thousand-call units. Unit cost is $0.30 per thousand calls.

Six months later the attributed cost is $15,000, up by a quarter, and the service handles 60 million calls. Unit cost is $0.25 per thousand calls. Total spend rose and unit cost fell by a sixth. The service got cheaper to run in the only sense that matters when traffic is growing.

Now change the story. In a different quarter attributed cost falls to $11,000 and calls fall to 30 million. Total spend dropped, and unit cost rose to about $0.37 per thousand calls. Someone celebrating the lower bill is celebrating a service that now costs more to run per unit of work, because traffic fell faster than the cost did.

The two stories show why a single trend line is not enough. Total and unit cost move in opposite directions whenever the cost is partly fixed. A provisioned instance bills the same at low load and at high load, so its unit cost is mostly a measure of how full it is. A consumption-metered service follows load more closely, so its unit cost is steadier and tells more about efficiency.

Choosing a unit

A good unit passes five tests.

  1. It follows the cost. Calls drive CPU and I/O, gigabytes kept drive storage and backups. A unit that does not move with the meter being measured produces a ratio that wanders for no reason.
  2. It is counted independently. The count should come from the application or the business, not from the database team, and not from something the database team can change by tuning. A unit the owner can shrink by changing the denominator is not a measurement.
  3. Its definition holds still. If “active customer” changes meaning in the middle of the year, every comparison across that boundary is meaningless.
  4. It shares the window. Monthly cost divided by a daily peak count is a ratio of two different things.
  5. The audience understands it. A unit that needs a paragraph of explanation will not be used in a budget meeting.

What makes a unit bad

Most failures are one of a handful of shapes.

A unit that is too coarse, such as cost per company, hides every movement that matters. One that is too fine, such as cost per query, is dominated by noise and by the allocation error underneath it. A unit with a tiny denominator, a new product with a few customers, swings wildly and teaches nothing. A unit counted on one side of a shared cluster while the cost covers both sides misattributes in a way that looks precise. And a unit that nobody outside the database team recognises will be dropped the first time it is inconvenient.

The limits of the method

Unit cost is a ratio of two estimates, and the error in each carries into the result. Present it as a range or a trend, not as a figure to the cent.

Cost steps. Adding a replica or moving to a larger instance class raises the cost in one jump, not gradually, so unit cost can show a sudden worsening that is a sizing decision, not a regression. Average cost is also not marginal cost: the cost of the next thousand calls on a half-empty instance is nearly nothing, and the cost of the next thousand on a full one is a bigger instance.

Seasonality distorts month-to-month comparisons, so compare like periods. Mix changes the answer too: if the share of expensive calls rises, unit cost rises without anything getting less efficient. And a falling unit cost is not proof that the database team did something right. It can come from growth alone.

Finally, a unit cost says nothing about quality. A service can get cheaper per call by dropping a replica and become less safe in the same change. Read unit cost beside reliability, not instead of it.

Put every Postgres you run on autopilot.

We onboard teams in small batches. Tell us about your fleet and we will reach out when a seat opens. One email, no drip campaign.