Most sites that have some sort of user profile will either do something like this:
profile.php?u=123445
or else:
profile.php?u=jason.Davis
So I am curious, would it be slower to use a name to lookup a profile with php/mysql vs. using a number to look up a profile record?
A string lookup would indeed probably be slower than a numeric one in probably every case. But the difference is so small it will never be noticed. Not until you have a really large number of users.
But check out SO: They do both.
http://stackoverflow.com/users/187606/pekka
The number for blazing fast database access.
The name for nice looks, and search engine visibility.
No conflicts with two names, because the ID is what is used to search the record.
I think that is the best of both worlds and the optimum.
Requires URL rewriting, though.
The name will be more readable and easier to debug, but names are not guaranteed to be unique so it will need to be augmented by a uniqifier (I believe this is actually a word, used in unification) to e.g. append digits to the end of the name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With