G
G
Godmode2015-11-11 21:41:17
PHP
Godmode, 2015-11-11 21:41:17

E-mail instead of id pros and cons?

In general, I decided to stir up a small site with registration and I thought that it would be nice to use e-mail instead of a login, I myself encountered this before, I think it’s convenient. Yes, even on the toaster, here we enter e-mail, although we also have logins.
But when authorizing, for example, and in general for all actions, you will have to choose WHERE `email`='[email protected]', it turns out I need to create by the email index field, I plan not many users, let's say 10 thousand.
Sampling by the e-mail field with indices will be slower than by id to numeric?
The database index seems to be stored in the operative if my memory serves me, how much will I lose on such a decision?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Stanislav Makarov, 2015-11-11
@god_mode_admin

1) I still don’t understand, you want email instead of login or instead of id. Start with one question and end with another.
2) If instead of a login, what does it mean "instead of"? Do not use login at all or use email for authorization?
3) If instead of id - it is, as it were, possible in theory, but no matter how it is worth it. Do you remember that you then put foreign keys in the form of emails? And update them when the address is changed by the user. That's right, it's tin, so it's not necessary.
4) Why are you even worried about WHERE `email`='[email protected]' - well , you authenticated a person once, put his id into the session, then select by id, what is the task?

D
DireX, 2015-11-11
@xDireX

Not a pro aside bd. But there are opinions that after changing the e-mail address, independent tables will not feel good.

E
entermix, 2015-11-11
@entermix

Email instead of a regular login - no problem, but instead of an ID - tin .. decide what exactly you want?

A
Artem Spiridonov, 2015-11-11
@customtema

Only pluses.
Although you formulated the question in a noobish way, somehow stupidly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question