It depends on the power of id . If it has high power (which means multiple rows have the same id value), indexing on id is a good idea. The database will look for id and look at several matching rows in the base table.
If half the table has the same id , the query will scan the index. Note that since you use * , an index with multiple columns will not be used if it does not contain all the columns in the table. Thus, this can be done faster only with an index containing all columns sorted by (name) .
At the end of the day, it is often best not to create an index at all until you come across certain performance issues. Specificity will allow you to check and measure whether your proposed index will work. This is almost always better than trying to guess the correct indexes.
source share