Skip to main content
SQL & Database Tools 100% Client-Side Browser Processing

SQL Cost Calculator

Model why query optimizers switch from B-Tree index range scans to full sequential scans as predicate selectivity rises.

0 chars · 0 lines · 0 B

How to Use SQL Cost Calculator

  1. Specify row count, average row width in bytes, engine page size (16 KB for MySQL InnoDB, 8 KB for PostgreSQL), and predicate selectivity %.
  2. Click Estimate I/O Cost to compare sequential table-scan pages against B-Tree traversal + bookmark lookup pages.
  3. 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.