The larger the data size, the greater the difference between indexes. In fact, small personal professional applications can achieve the desired speed without indexing. When there are about 1000 data records, the additional overhead of tree search is greater, and searching from the beginning is faster normally. However, when the data grows, there will be a situation where no index is available. Therefore, the index is very important. In addition, there is a certain degree of internal optimization in MySQL. It will determine whether to use indexes quickly or not based on the number of records.
However, MySQL is also insufficient, and the applicability of MySQL is a little poor. Even if you query an indexed column, some SQL statements do not use the index.
The column specified in the where, order by, and group by conditions.
For example, if the select * from entry where url = "http: //..." query specifies the URL column in The where statement, it will be used if the URL column has an index.
When the index is valid
-> Explicitly added Indexes
-> Primary key and unique constraints
In MySQL, apart from explicitly adding indexes using the alter table command, columns with primary keys and unique constraints have indexes. Use the show Index Command to confirm the index content.
MySQL index traps
-> To use the index of multiple columns at the same time, you must use a composite index.
There is a problem here. MySQL can only use one index for each query. If you want to use two indexes at the same time, you must set the index (URL, timestamp.