ceramic hob, hob, electricity, save electricity, kitchen stove, hot, cook, stovetop, electric cooker, spiral, glow, heat, electricity costs, power savings, ceramic hob, ceramic hob, hob, hob, hob, hob, hob, stovetop, electric cooker
Photo by congerdesign on Pixabay

Cost Control

Part of Managed databases in the cloud

Estimating database costs from storage and query activity

Build a managed-database cost estimate from running capacity, storage, backups, transfers and the right query billing model.

Estimate database cost in the billing units of the chosen service. On a managed relational instance, query activity usually affects the capacity required rather than producing a simple charge for each SQL query. On an on-demand analytical service, data read by queries can be a direct billing input. Keep those models separate.

Build a workload sheet

For every production, development and test environment, record region, engine, tier, running time, provisioned storage, data and index size, growth, backup retention, replicas, data transfer and a representative busy-period query sample. Include temporary restored copies in a recovery-exercise scenario. Mark unmeasured inputs as assumptions.

Estimate a normal month, a busy month and a recovery exercise. Use current rates for the exact configuration, region, currency and billing terms when turning quantities into money.

Separate the cost inputs

InputQuantity to checkReason
Running capacityInstance or compute tier and billed running timeAn instance may cost money while queries are quiet
Primary storageProvisioned capacity or billable stored data, as defined by the serviceIndexes, logs and growth affect requirements
Backup historyBillable backup usage and retentionMore retained history can increase storage
Extra copiesReplicas, high-availability resources and temporary restoresAdditional resources may be charged
Data movementRelevant transfer routesCharges depend on provider and route

Do not transfer one provider's storage basis to another. Amazon RDS on-demand DB instances are billed by instance class, while provisioned storage and backup storage can remain billable when an instance is stopped.

Azure Database for PostgreSQL flexible server structures pricing per server by tier, vCores and storage. MongoDB Atlas cluster configuration and data transfer costs depend on deployment and use.

Database Cost Components Across Cloud Providers

Amazon RDS On-Demand
Billed by instance class; storage and backups billable even when stopped
Azure PostgreSQL Flexible Server
Priced per server tier, vCores, and storage; no charge for idle compute
Google Cloud SQL
Billing based on compute tier, storage, backup retention, and data transfer
MongoDB Atlas
Cluster costs depend on deployment type; data transfer billed separately
Google BigQuery
On-demand: billed by data processed; capacity: billed by slots

Translate query activity correctly

For a relational instance, use a representative query mix and busy period to assess CPU, memory, I/O, latency and concurrency on a proposed tier. If it cannot meet the workload, estimate the cost of a viable configuration or query changes. Do not multiply SQL query count by an invented per-query rate.

For BigQuery, estimate stored data separately from query processing. Its on-demand model bills queries by data read, while capacity pricing uses slots. Group recurring reports by frequency and expected bytes processed.

A dry run can estimate query bytes and show how much data a query will process before execution.

Calculate and revisit

For each applicable charge, calculate billable quantity × current unit rate, then add the lines for each scenario. Keep units and billing periods beside the figures: instance time, provisioned storage, backup usage and query data read are different quantities. Check applicable discounts, minimums, tax and currency terms in the current quote or bill.

Compare the estimate with observed usage after launch. Identify whether data growth, tier size, extra copies, transfer or query patterns differed from the assumptions, then update the workload sheet.

Steps to Estimate Database Costs Accurately

  1. Build a workload sheet with environment detailsInclude region, engine, tier, running time, storage, growth, backups, replicas, and query samples
  2. Separate cost inputs by categoryRunning capacity, storage, backups, extra copies, data transfer
  3. Translate query activity correctlyUse representative mix; avoid multiplying query count by arbitrary rates
  4. Calculate using current unit ratesMultiply billable quantity × rate; include tax, discounts, currency
  5. Compare estimate with actual usage post-launchAdjust assumptions for data growth, query patterns, or extra resources

More from Cost Control