How do you determine how far to normalize a database?

前端 未结 13 2187
醉梦人生
醉梦人生 2020-11-29 06:36

When creating a database structure, what are good guidelines to follow or good ways to determine how far a database should be normalized? Should you create an un-normalized

13条回答
  •  余生分开走
    2020-11-29 07:23

    Database normizational I feel is an art form.

    You don't want to over normalize your database because you will have too many tables and it will cause your queries of even simple objects take longer than they should.

    A good rule of thumb I follow is to normalize the same information repeated over and over again.

    For example if you are creating a contact management application it would make sense to have Address (Street, City, State, Zip, etc. . ) as its own table.

    However if you have only 2 types of contacts, Business or personal, do you need a contact type table if you know you are only going to have 2? For me no.

    I would start by first figuring out the datatypes you need. Use a modeling program to help like Visio. You don't want to start with a non-normalized database because you will eventually normalize. Start by putting objects in there logical groupings, as you see data repeated take that data into a new table. I would keep up with that process until you feel you have the database designed.

    Let testing tell you if you need to combine tables. A well written query can cover any over normalization.

提交回复
热议问题