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 - MySQL Tutorial
From the course: MySQL Database Administration
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Creating an index4m 41s
-
(Locked)
The UNIQUE constraint4m 8s
-
(Locked)
The NOT NULL constraint3m 59s
-
(Locked)
Challenge: Indexes and constraints1m 12s
-
(Locked)
Solution: Indexes and constraints9m 24s
-
(Locked)
Stored procedures6m 27s
-
(Locked)
Challenge: Stored procedures2m 3s
-
(Locked)
Solution: Stored procedures4m 23s
-
(Locked)
Triggers7m 50s
-
(Locked)
Challenge: Triggers1m 41s
-
(Locked)
Solution: Triggers5m 8s
-
(Locked)
-
-