I have table with approximately 10 million rows, with the id
column being primary key
.
Then I delete all rows where id > 10
. Only 10 rows remain in the table.
Now, when I run the query SELECT id FROM tablename
, execution time is approximately 1.2 - 1.5 seconds.
But SELECT id FROM tablename where id = x
only takes 10 - 11 milliseconds.
Why is the first SELECT
so slow for just 10 rows?