Optimizing with aggregations
Any time you want to optimize your data model, in addition to reducing the data storage by removing unnecessary columns and rows, it's also important to consider removing data by summarizing or using group by to reduce the number of rows and/or columns in your data if the additional grain is not needed.
For example, the data warehouse we use to store the data of historical sales and inventory data needed by our organization may contain highly detailed information, such as every sale made for every day of the business year. Additionally, it may contain multiple years of data. This kind of detail may be needed for some analysis, but other reports and analytics may only need total sales per month. So, in those cases, we can simply summarize the data by grouping the data by calendar year and month. Aggregating by month can reduce millions of rows of data into less than 100 rows, which can dramatically increase performance.
To illustrate this concept...