Question regarding MySQL indices and their functionality
- by user281434
Hi
Say I have an ordinary table in my db like so
----------------------------
| id | username | password |
----------------------------
| 24 | blah | blah |
----------------------------
A primary key is assigned to the id column. Now when I run a Mysql query like this:
SELECT id FROM table WHERE username = 'blah' LIMIT 1
Does that primary key index even help? If I am telling it to match usernames, then shouldn't the username column be indexed instead?
Thanks for your time