From the course: MySQL Database Administration

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Creating an index

Creating an index

- [Instructor] All right. In this lecture, we're going to be talking about indexes, and using an index is one of the best ways that you can speed up the performance of your tables and your queries. This is how mysql.com talks about indexes. The best way to improve performance of SELECT operations is to create indexes on one or more of the columns that are tested in the query. The index entries act like pointers to the table rows, allowing the query to quickly determine which rows match a condition in the WHERE clause and retrieve the other column values for those rows. All MySQL data types can be indexed." So, what does that mean exactly? Let's walk through a quick visual. Here, we've got our table, and here's what searching without an index looks like. The server goes through each row until it finds the row that it's actually looking for, in this case, inventory_id equals 9. This isn't a particularly efficient way to search. So, let's take a look at what happens once you have an…

Contents