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.

Calculations run locally in your browser

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

Continue with Utility Matrix tools for the next decision in this workflow.
Browse tools →
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.
Managed PostgreSQL hosting. Railway provides a hosted PostgreSQL option for teams that want a managed database alongside application deployment.
View Railway PostgreSQL options →
External site · Independent provider · We may receive a commission · Not a recommendation