Database & SQL

SQL Query Cost Estimator

Enter table row count, pages, query selectivity, and storage type to estimate sequential scan vs index scan cost using PostgreSQL's cost model.

No data is transmitted — everything runs locally

SQL Query Cost Estimator

The SQL Query Cost Estimator computes PostgreSQL sequential vs index scan cost from table statistics and storage type using the PostgreSQL cost model.

• Estimate whether an index will be used before creating it on a large table

• Understand why PostgreSQL chooses a sequential scan over an index for a given selectivity

• Tune random_page_cost for SSD storage to improve plan choices

• Model query cost improvement from adding an index on a high-selectivity column

Developer-friendly cloud infrastructure. DigitalOcean provides cloud compute, networking, and managed databases with predictable pricing.
Host databases on DigitalOcean
External site · Independent provider · We may receive a commission · Not a recommendation
What does this tool tell you?
The SQL Query Cost Estimator computes PostgreSQL sequential vs index scan cost from table statistics and storage type using the PostgreSQL cost model.
What affects the result most?
Sequential scan cost: seq_page_cost × relpages + cpu_tuple_cost × reltuples. Index scan cost: random_page_cost × pages_fetched + cpu_index_tuple_cost × index_tuples. PostgreSQL cost model: random_page_cost default 4.0 (HDD), reduce to 1.1 for SSD storage.
How should I use the result?
The calculation is deterministic — the same inputs always produce the same output — so the most useful workflow is to vary one input at a time and see which factor moves the result most. That tells you where to focus your attention before committing to a decision.
Database credential management. 1Password Teams for database teams managing connection strings, replication credentials, and DBA access keys.
View DB credential management →
External site · Independent provider · We may receive a commission · Not a recommendation