SQL Cost Calculator
Model why query optimizers switch from B-Tree index range scans to full sequential scans as predicate selectivity rises.
How to Use SQL Cost Calculator
- Specify row count, average row width in bytes, engine page size (16 KB for MySQL InnoDB, 8 KB for PostgreSQL), and predicate selectivity %.
- Click Estimate I/O Cost to compare sequential table-scan pages against B-Tree traversal + bookmark lookup pages.
- Use the crossover insight to decide between a selective index, a covering composite index, or partitioning.
How SQL Cost Calculator Works
Secondary B-Tree indexes require random leaf-to-clustered/heap lookups unless the index covers every selected column. Once a query matches roughly 15–20% of table pages, random page fetches often cost more than scanning data pages sequentially.
Data Privacy & Security Notice
SQL Cost Calculator executes locally inside your browser tab using JavaScript and WebCrypto APIs. Your input payloads, tokens, SQL queries, and secrets are never transmitted to TechnoLila servers or third-party endpoints.
Frequently Asked Questions
Why does MySQL ignore my index when selectivity is high?
InnoDB secondary index lookups bounce back to the clustered primary-key B-Tree for non-covered columns. When too many rows match, sequential I/O across the clustered index is cheaper.