Why You Shouldn’t Use Email as a Foreign Key: A Case for Integer IDs in Database Design
While watching a youtube video with a pretty high number of views i noticed that the instructor was using the email field as a foreign key to reference the users table.
You may say that it's fine the email field is unique and it make sense to use it as a primary key.
Or if i introduced an argument like string comparison is slower than int comparison you may say that it still fine to do so because generally we use uuid for security & scalability reasons
Well yeah but imagine that you are in a scenario were your app has 114 tables referencing the user table.
Then a user decided to update his email , imagine how inefficient that will be!