The base query involved in OLAP is the 'rollup'. In SQL this is achieved by a 'group by' statement.
If you have 3 dimensions: age, sex and marital status you can answer loads of questions with the result set from:
select age, sex, marital_status, count(*)
from fact
group by age, sex, marital_status
for example, with a result set of.....
age, sex, marital_status, count(*)
23 , M, single, 12
23 , M, married, 2
23 , M, divorced, 0
23 , F, single, 8
23 , F, married, 3
23 , F, divorced, 1
Q. how many males? 12+2 = 14
Q. how many married people? 2+3 = 5
Q. how many married males? 2
Q. %age males who are married? 2/14 * 100 = 14%
The point is, as we have a summary we have to look at fewer rows of data to get the answers.
The basic difference between ROLAP and MOLAP is that in Relational OLAP we will ask the database to do the group-by at the time and then work with the result, and in MOLAP we will pre-rollup the whole database.
ROLAP is flexible and quick as long as the amount of data it has to roll-up is limited. MOLAP can lead to very quick results for users as it is precompiled. Jeremy Nicholson, Director of
a UK-based Java and Data Warehousing consultancy