What is best for profile, number or name?

Most sites that have some kind of user profile will either do something like this:

profile.php? u = 123445

or more:

profile.php? u = jason.Davis

So I'm curious if it will be slower to use the name to search for a profile with php / mysql versus using the number to search for a profile record?

+5
source share
7 answers

String searches are likely to be slower than numerical, probably in each case. But the difference is so small that it will never be noticed. Until you have a really large number of users.

But check out SO: They do both.

http://stackoverflow.com/users/187606/pekka

A number for quick access to the database.

.

, - , .

, .

URL.

+12

, , uniqifier ( , , ), , .

+2

, , - , , , , .

, , , , , . , . .

+1

DB, . , ? UIDs , .

0

. profile.php u = 12345. 12345. , /profile/ 12345.

- REST, :)

0

[...]?

, , . , , .

0

If the name is the key in the database, the search time should not be too different, and using the name will give you more attractive URLs, so I would suggest using names.

-1
source

All Articles