should this database table be normalized?

孤人 提交于 2019-12-05 15:42:09

Don't assume that queries will be slower after normalizing. Joins on a small number of tables are very cheap if the tables are indexed properly.

On the other hand, queries on a non-normalized table can easily end up being much slower. For example, in your original schema, simply trying to query the distinct dates on which a workout was done is far more expensive than it would be with the normalized version.

Definitely normalize it at this point. If you run into performance issues later on, then you can start selectively denormalizing certain parts of the data in addition to the already-normalized schema. But in all likelihood you will never reach that point with a small database.

The new refactoring seems good, and performance will not be all that affected if you have the appropriate indexes on the various tables. (Indexes can be created on all foreign keys)

So YES, that seems like a perfectly normal refactoring.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!