OLAP Operation Types

  • + 1 comment

    ROLLUP

    In addition to the regular aggregation results we expect from the GROUP BY clause, the ROLLUP extension produces group subtotals from right to left and a grand total. Lets say you have table with two columns a,b.

    a = 1,2

    b = 3,4

    Regular aggregation is will return 4 rows (2x2)

    1,3

    1,4

    2,3

    2,4

    Rollup will return SUBTOTALS for every row from the right plus one subtotal for all rows (like sum on no aggregation) . There would be 7 rows :

    1,3

    1,4

    1,null

    2,3

    2,4

    2,null

    null,null

    CUBE

    In addition to the subtotals generated by the ROLLUP extension, the CUBE extension will generate subtotals for all combinations of the dimensions specified. If "n" is the number of columns listed in the CUBE, there will be 2n subtotal combinations.

    Lets say you have table with two columns a,b.

    a = 1,2

    b = 3,4

    Cube will return SUBTOTALS for every row in every direction plus one subtotal for all rows (like sum on no aggregation) . There would be 9 rows :

    1,3

    1,4

    1,null

    2,3

    2,4

    2,null

    null,3

    null,4

    null,null