Is it bad design practice to repeat fields in a database in order to save yourself some convoluted queries? -


If you have some tables in which you have all the information you need, but there are some complex involved in it.

Thank you in advance

Paul

Yes and no .

This is intentionally going against the principle of database generalization, and it is called "denormalisation".

Its bad points are many reasons why we believe in general, most importantly, in the way that an error can make itself incompatible with the database, in general, this poor DB design is in practice, It updates the database and both of them are more complex and therefore more expensive (and they do not accept any mistake).

Although this can give performance benefits to some questions which always vary in time to time, and due to being trivial, it is a proper and sometimes necessary, customizable.

I want to do the following approach to do this:

  1. Its requirement repeats. Specifically, CTE has made some cases which I did not want to use this technique, because CTE could only see several tables in some teams (in fact, in most cases where I had resorted to it in the last days) -Support was needed, could it be Sometimes, which is really necessary, there is a thorough investigation of the indices involved in it. In the end, it is trying things that have been adapted through the use of denormalisation, each time without using it; All types of changes can remove the requirement for this.

  2. Create a separate table for relevant data, consider "Lookup" which is not considered to be part of the main design, highlighting other developers that it is rather just a bad db design It is an adaptation, it also makes it easy to rebuild the whole thing, an error should be the reason for the incompatibility mentioned above.

  3. Use the trigger to maintain the table so that the updates of the tables depend on it, but instead of keeping things right, instead of keeping it special Rather than implementing the rules (those rules will almost certainly be broken, or at least the code should be less obvious).

Comments