Indexes
Learn about the use of indexes.
We'll cover the following
Overview of indexes
Searching for a particular customer inside a table that has two customers is quick. The response is returned within 0.00 seconds. Is the response equally fast when a table has two million customers, though? No way. When we issue the select
statement, for example, MySQL will scan the whole table. It starts from the first row and takes all the rows one by one until it matches the row with the required identity
value. This is very slow when a table has a lot of rows. Even with only a few thousand rows, such queries will experience delays in returning the results.
To speed up the response of these queries, we need to use indexes. An index is a tool that will help us search. MySQL uses the index in the background to retrieve data quickly.
An index in MySQL is like the index at the end of a book. It has terms and the pages where the term can be found, which helps the reader quickly locate the page that references a term.
Get hands-on with 1400+ tech skills courses.