mySQL - Should I denormalise?

后端 未结 6 1820
傲寒
傲寒 2021-01-14 07:56

Overview (Sorry its vague - I think if I went into more detail it would just over complicate things)

I have three tables, table one contain

6条回答
  •  逝去的感伤
    2021-01-14 08:40

    Every rule might be broken if there is a good reason for it.

    In your case I wonder what the three tables contain. Does Table three really describe Table two or does it describe table one directly?

    The disadvantage to have self-id, table-two-id and table-one-id in table three in this case is, that it can lead to inconsistence - what if you have table-one-id 1 in table two and table-one-id 15 in table three by a mistake?

    It depends on the data and the entity relationship of your data. For me, it would be more important to have no inconsistencies and to have a little bit more time at selection...

    EDIT: After reading about your Tables I would suggest to add a table-one-id to table three (areas), because table-one-id doesn't change after all and for that reason its relatively save for inconsistency.

提交回复
热议问题