The intentional introduce of redundancy in a table in order to improve performance is called “Denormalization”. Denormalization is a technique to move from higher to lower normal forms of database modeling in order to speed up database access. Denormalization is usually done to decrease the time required to execute complex queries
Queries that have a lot of complex joins will require more CPU usage and will adversely affect performance. Sometimes, it is good to denormalize parts of the database.
Examples of design changes to denormalize the database and improve performance are:
If you have calculated the total cost of each order placed as the cost of the product plus a tax of 10% of the product cost, the query to calculate the total cost sales as follows:
select sum((cost*qty)+(0.10*cost*qty)) from orders join products on orders.ProductId =products.ProductId
If there are thousands of rows, the server will take a lot of time to process the query and return the results as there is a join and computation involved.
To find the total sales write simple query:
select SUM(ORDERCOST)from orders