I’m for the first time making a bigger database using MySQL. Since it’s going to be a bigger one I need better performance for the queries. So I looked into indexes. Since this is what I was learned I always make a column named id which is auto-incremented and is used as a primary index.
After some searching and reading I think I’ve understood some things about indexing but I want to be sure.
Indexes is useful when you use a select query with, for example a WHERE clause because instead of searching the whole table, it just searching in a smaller part. You should index things that are used in WHERE and JOIN clauses.
Is it good enough to just add a index in phpMyAdmin on the columns that you want to index or do I have to do something when doing a select query?
You don’t need to make any changes to your SELECT statements. MySQL will automatically use the indexes for lookups when it can.
So yes, it’s good enough to add the indexes via phpMyAdmin.
To see this in action, once you’ve created your indexes, try running a SELECT query prefixed with EXPLAIN. MySQL will tell you which indexes are being used.