Limited SQL query returns all rows instead of one

limit, mysql, select

Solution

The rows count shown is only an estimate of the number of rows to examine. It is not always equal to the actual number of rows examined when you run the query.

In particular:

LIMIT is not taken into account while estimating number of rows Even if you have LIMIT which restricts how many rows will be examined MySQL will still print full number.

Source

When the query actually runs only one row will be examined.

Problem

I tried the SQL code: ``` explain SELECT * FROM myTable LIMIT 1 ``` As a result I got: ``` id select_type table type possible_keys key key_len ref **rows** 1 SIMPLE myTable ALL NULL NULL NULL NULL **32117** ``` Do you know why the query would run though all rows instead of simply picking the first row? What can I change within the query (or in my table) to reduce the line amount for a similar result?

Original source