Yet more on summaries

In addition to the conventional

Select D1,D2,SUM(M1) from base group by D1,D2
type of summary Oracle offers two other approaches: Oracle OLAP cubes and the various extensions to GROUP BY. Oracle OLAP has it roots in the Oracle Express technology - that is the the stand alone OLAP database and not any more recent additions to the product line with the word Express in the name. A good source of reading on this is Mark Rittman's Blog I won't say too much on this except that relational views over OLAP cubes allows the use of non-Oracle OLAP aware query tools to access cube data, especially if you use advanced rewrite to map many levels to a single entry point.

I have mentioned GROUP BY ROLLUP and GROUPING SETS in the past when I talked about partitioning. The true utility of these ways to group data is the efficiency of the building of the aggregate, they are often far superior to creating a similar series of summary tables using more traditional SQL. The downside is they can be harder to use from query tools as you need to indicate how the aggregate was formed to the query tool. For example, suppose you had a sales summary by geography and product and that two of your groupings were TOTAL PRODUCT by STATE, and PRODUCT TYPE by STATE, we must not add up all of the rows that return a STATE value as we will be double counting our sales. Columns such as GROUPING and GROUPING_ID help us work around that problem. And as I said in the earlier piece GROUPING_ID makes a good choice for a LIST type sub-partition key.