mercredi 7 janvier 2015

What's worse, too many entities or too many tables?


I just had a question about database design, I am in fairly early learning stages of this so bear with me.


Suppose I have a parent table called "Projects" each "Project" Entity can have any number of "Attachments" and each "Attachment" can have any number of "Anchors".


I can only see a few possible solutions for this. Estimations assume 10 years use of this database: 300 Projects/year * 3 Attachments/Project * 20 Anchors/Attachment


Solution 1 (My initial design idea): Involves 3 tables. "Projects"->"Attachments"->"Anchors" Number of Tables: 3 Max entities in a table: 180,000 in "Anchors"


Solution 2: Involves 2+n tables. "Projects"->"Attachments"->"Anchors[n]" Number of Tables: 9,002 (9,000 Anchor Tables) Max entities in a table: 9,000 (In Attachment Tables)


Solution 3: Involves 1+n1+n2 tables. "Projects"->"Attachments[n1]"->"Anchors[n2]" Number of Tables: 12,001 (3,000 Attachment + 9,000 Anchor) Max entities in a table: 3,000 (In Project Tables)


To summarize:

What's worse, more entities or more tables? AND/OR Is there simply a better design for this situation that I am unaware of?





Aucun commentaire:

Enregistrer un commentaire