Literal answer: 100% is not guaranteed; also "single-column" versus "composite" is not the right question, as Erik points out.
Practical answer: Given where column2=xxx
, you should have an index starting with column2
.
Long answer:
The database engine applies a lot intelligence toward "caching" indexes and data. The goal is to make the typical query fast on average.
If there is not much "churn", blocks of data and indexes are brought into RAM (the "buffer_pool") and they live there. The first query after a restart will have to do some I/O to fetch blocks from disk; this is slow. Subsequent queries can skip some or all of the fetches; hence they are faster. That is, other queries can happen to make _this query faster. Hence the 100% is defeated. (And there is no way to achieve "100%" without slowing everything down to a constant, but inefficient, speed.)
More on creating optimal indexes: http://mysql.rjweb.org/doc.php/index_cookbook_mysql
Let me confuse things further. In your specific 3-column table, and with your specific SELECT *
, here is the usual pecking order; slowest to fastest
INDEX(column2, column1) -- index's BTree is bulkier than the next
INDEX(column2) -- good (and recommended)
INDEX(column2, column1, id) -- "covering" all of "*" is in the index
When building indexes, it is best to collect all the important queries (Select, Update, Delete) together to decide which set of indexes to have. This Question has only addressed one specific select for that specific schema.