I was reading about relational databases like sqlite and I always see the schema for user storage like:
UserID (index) | Username | Password
but wouldn't it be actually much faster to use Username as an index?
For example when a user logs in you query WHERE username == some_name, the database engine has to search through all record for this data, right? (namely SQLite? - I am using this)
Why do I always see this "ID" and not just username as the index?
Assuming all names will be unique, what is the point in an integer based index?
What is the actual difference in terms of lookup speed? Or space? (assuming a maximum character count at 24 characters).
Or would it be even better to just make a additional/separate lookup table for username<->userid resolving and then load the data with userid from the main table where the index is the userid?