mysql - More Efficient Foreign Key Relationship or Large Table (thinking through the problem)? -


this question may extremely naive, in case, apologize. i'm trying learn more database administration , i'm uncertain choice preferable in case. have model split 2 tables. contains contact info , profile info companies.

     class company(models.model):          name=models.charfield(max_length=100)          street_address=models.charfield(max_length=100, blank=true)          city=models.charfield(max_length=100, blank=true)          state=models.charfield(max_length=100, blank=true)          zipcode=models.integerfield(max_length=5, blank=true)          input_level=models.charfield(choices=((0,'less',),(1,'more'))          expense_min=models.integerfield(blank=true)          expense_max=models.integerfield(blank=true)         health_value=models.integerfield(choices=[(i+1,i+1) in range(5)], blank=true)         group_size=models.integerfield(blank=true)          comment=models.textfield(max_length=500, blank=true)         created=models.datefield(auto_now_add=true)         registered=models.booleanfield(default=false) 

though there decent number of columns, don't see explicit reasons break related tables. profile related info (below zipcode) may change often, though address related info stay same. i'd assume cost of joins outweigh cost of updating/inserting table many rows.

is there basic rule here or have profile it?

there no right or wrong answers in regards normalization , denormalization of schemas.

you should ask yourself, performance important criteria? if incur costs of program complexity , go denormalized table.

if tables small , performance not big issue, don't trouble program complexity. forgetting update column in table cause lot of problems.

also don't forget indexes cannot used joins.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -