For example, a website like stackoverflow.com, is it useful to use an email address to identify users in many tables?
Itโs bad if the primary key is very long, say
VARCHAR (50)
or even
VARCHAR (100)
?
Not really. For any significant data set, you end up wasting a lot of space, and when polling you will get a performance hit. Also, if someone modifies their email (which you may or may not allow), you need to change it everywhere.
, , .
. -, , ? , .
-, . , ? , .
-, - auto-incrementing ID. (, ) .
, memberID member. questionID question memberID member, , . Etc.
memberID
member
questionID
question
, , , (3NF). , .
, , , , ,
. , . , . ( ? ? -?)
- . . , 13 .
, ( ?). , , a) , b) , .
post Jay Pipes int char , .
, . .
. . , . .
If your columns are indexed correctly, most modern databases (Oracle, Postgres, SQLServer) will not punish you for participating in an email address. If you are worried about joins, create a denormalized materialized view and pay the price for insert / update.
Source: https://habr.com/ru/post/1724698/More articles:Git status is a bit confusing - gitIs it possible to override a hidden method? - overrideWorkflow Foundation with DDD - domain-driven-designConfigure and disable Jstestdriver - javascriptDelete subclass in qt? - pythonShould domain objects implement IXmlSerializable? - c #How do I know which item in the Microsoft Access selection list was selected? - vbaะะฐะบ LLBLGen Pro ััะตะบะฐะตััั ะฟัะพัะธะฒ Nhibernate Performance Wise - performanceSon Suckerfish Menu IE6 - Menu Hiding Behind Content - javascriptString concatenation in SQL Server 2005 - sqlAll Articles