问题
I am currently developing an mvc application to read from an existing sql server database. The database is denormalized - and I was looking at modifying some tables to normalize it to a degree.
This led to a discussion with a fellow developer as the most preformant way to read the data, or if the structure should change or not. The data will be read via ado.net with a stored procedure. Question I have is, is it more performant to have numerous fields in a table (denormalized) OR have several tables with inner joins (normalized) to retrieve the data?
I should have mentioned, the actions on the tables will be 95% read, 5% write.
回答1:
Your should use denormalized data for data analysis purposes, intensive reporting usage. For the mentioned purposes having a denormalized will contribute to improve performance.
Without having much knowledge about the application you are going to implement, for a 'standard' client-server application, where you are supposed to work with a DOM plenty of classes and read & write data constantly, I would go vote for normalizing the data and avoid as much as possible maintaining duplicated data. Try to simplify the design the of the tables so that they 'feel comfortable' with your domain model.
So, briefly, normalized more performant for intensive data read, denormalized more performant (and more comprehensive) for intensive read & write of domain object model classes.
回答2:
Keep it de-normalised for a reporting application.
As long as the de-normalised structures fit your needs, it will be faster.
If it's being populated from a normalised database(s), all is good. Even if it wasn't I still wouldn't normalise this database, I'd create a normalised version for data collection and then use that to populate your current structure.
The design compromises you have to make to do collection and reporting from one database, don't take long to cost a lot more than another database server and some sort of transfer manouever.
回答3:
If you are going to be reading more than writing, denormalization is a good idea.
If you will be writing more than reading, you should normalize your tables.
If you are not sure, or will have a blend of both, try benchmarking or load testing with both configurations, and see which works better for your application.
回答4:
To retrieve the data denormalized is good choice because less no of joins , storage is cheaper than performance cost.
回答5:
Normalization is primarily about elimination of duplication, for ease of maintenance and minimization of storage required.
Denormalization is primarily done to improve the performance of specific queries, but because some data is duplicated (usually key data) it does make maintenance a touch trickier, and increases storage requirements.
来源:https://stackoverflow.com/questions/12943776/more-performant-to-have-normalized-or-denormalized-tables