Professional Documents
Culture Documents
Lecture On OLAP
Lecture On OLAP
Chapter 15
OLAP IN THE DATA
WAREHOUSE
Slides Complied from: Paul Chen
Summary of Topics
1.
2.
3.
4.
5.
6.
7.
SQL has been the accepted interface for retrieving and manipulating data
from relational databases. These methods are used in OLTP systems and in
data warehousing environments (referring to the environments with simple
queries and routine reports).
Now consider information retrieval and manipulation in these
environments- reports writers and spreadsheets.
Report writers: two features- the ability to point and click for generating
and issuing SQL calls, and the capability to format the output reports.
However, report writers do not support multidimensionality. With basic
report writers, you cannot drill down to lower levels in the dimensions. You
cannot rotate the results by switching rows and columns. The report writers
do not provide aggregate navigation. Once the report is formatted and run,
you cannot alter the presentation of the result data sets. Spreadsheets are
still cumbersome for showing all the aggregate levels and multidimensional
views, let alone doing calculations for roll-up and drill-down.
OLAP Benefits
Increasedproductivityofendusers.
ReducedbacklogofapplicationsdevelopmentforIT
staff.
Retentionoforganizationalcontrolovertheintegrity
ofcorporatedata.
ReducedquerydragandnetworktrafficonOLTP
systemsoronthedatawarehouse.
Improvedpotentialrevenueandprofitability.
OLTP (RELATIONAL)
ATOMIZED
PRESENT
RECORD-AT-A-TIME
PROCESS ORIENTED
OLAP
(MULTIDIMENSIONAL)
SUMMARIZED
HISTORICAL
MANY RECORDS-AT-ATIME
SUBJECT ORIENTED
OLAP VS OLTP
WHILE OLTP APPLICATIONS GENERALLY DO
NOT REQUIRE HISTORICAL DATA, NEARLY
EVERY OLAP APPLICATION IS CONCERNED
WITH VIEWING TRENDS AND THEREFORE
REQUIRES HISTORICAL DATA. OLTP
APPLICATIONS AND DATABASE TEND TO BE
ORGANIZED AROUND SPECIFIC PROCESSES
(SUCH AS ORDER ENTRY), OLAP
APPLICATIONS TEND TO BE SUBJECTORIENTED ANSWERING SUCH QUESTIONS AS
WHAT PRODUCTS ARE SELLING WELL OR
WHAT ARE MY WEAKEST SALES OFFICES?
10
11
Fact Table
Time
Time key
Date
Month
quarter
year
Product Key
Store Key
Time Key
Fixed Cost
Variable cost
Profit margin
YTD_Sales_dollars_by_store
YTD_Sales_dollar_by_category
YTD_Sales_By_department
Store
Store key
Store name
region
Store
Product
Month
Product
Product Key
Product Name
Category
Product line
12
Kinds of Queries
Displaythetotalsalesofallproductsforpastfiveyears
inallstores.
Comparetotalsalesforallstores,productbyproduct,
betweenyears2000and1999
Showcomparisonoftotalsalesforallstores,product
byproduct,betweenyears2000and1999onlyfor
thoseproductsforreducedsales.
13
Cube
14
Lattice of Cuboids
all
time
time,item
0-D(apex) cuboid
item
time,location
location
item,location
time,supplier
time,item,location
supplier
location,supplier
item,supplier
time,location,supplier
time,item,supplier
1-D cuboids
2-D cuboids
3-D cuboids
item,location,supplier
4-D(base) cuboid
time, item, location, supplier
15
Cube
Fact Table View
Multi-Dimensional Cube
Property sale
sale p
Branc
h
p1 c1
p2 c2
p3 c3
p4 c1
wee pric
k
e
1
1
2
2
2
4
1
3
P = property #
week 2
week
1
P1
P4
c
p2 1
p3
c2
2 c3
4
C1 C2
1
3
C3
16
CUSTOMER # TELEPHONE
10001
345-4444
10002
10003
ADDRESS
40 MAIN
345-6666
345-8588
30 ELM
6
17
18
19
product/region/sales table
Product
Nuts
Nuts
Nuts
Screws
Screws
Screws
Bolts
Bolts
Bolts
Washers
Washers
Washers
Region
East
West
Central
East
West
Central
East
West
Central
East
West
Central
Sales
50
40
30
60
50
60
100
120
80
90
100
40
20
21
QUERY ON MULTIDIMENSIONAL
DATA
QUESTIONS LIKE WHAT WERE TOTAL SALES OF
NUTS? OR WHAT WERE TOTAL SALES FOR THE
EAST? TO FIND THE ANSWER IN THE TWO
DIMENSIONAL TABLE, JUST FIND THE CELL
CALLED EAST AND ADD UP ALL THE NUMBERS IN
THE COLUMN.
22
EAST
50
60
120
90
300
WEST
50
80
100
310
CENTRAL
TOTAL
40
30
60
40
210
170
300
230
820
23
24
25
TERMINOLOGY
27
East
Central
West
Product Total
nuts
Bolts
Screws
Washers
28
West
EAST
Calif
Central
Oregon
Washington
Seattle
Bellevue
29
OLAP Operations
30
Slicing
31
Dicing (Sub-cube)
32
Roll-Up
33
Drill-Down
34
36
37
38
OLAP Applications
AlthoughOLAPapplicationsarefoundinwidely
divergentfunctionalareas,allhavefollowingkey
features:
multidimensionalviewsofdata
supportforcomplexcalculations
time intelligence.
39
Corerequirementofbuildingarealisticbusiness
model.
Providesbasisforanalyticalprocessingthrough
flexibleaccesstocorporatedata.
Theunderlyingdatabasedesignthatprovidesthe
multidimensionalviewofdatashouldtreatall
dimensionsequally.
40
Mustprovidearangeofpowerfulcomputational
methodssuchasthatrequiredbysalesforecasting,
whichusestrendalgorithmssuchasmovingaverages
andpercentagegrowth.
Mechanismsforimplementingcomputationalmethods
shouldbeclearandnonprocedural.
41
Keyfeatureofalmostanyanalyticalapplicationas
performanceisalmostalwaysjudgedovertime.
Timehierarchyisnotalwaysusedinsamemanneras
otherhierarchies.
Conceptssuchasyeartodateandperiodoverperiod
comparisonsshouldbeeasilydefined.
42
43
44
45
46
47
48
49
51
52
53
54
55
56
57
Thereareproposalstoredefinedorextendedthe
rules.Forexample,toalsoinclude:
Comprehensivedatabasemanagementtools
Abilitytodrilldowntodetail(sourcerecord)level
Incrementaldatabaserefresh
SQLinterfacetotheexistingenterpriseenvironment
58
59
60
61
62
63
64
65
Supports RDBMS products using a metadata layer avoids need to create a static multi-dimensional data
structure - facilitates the creation of multiple multidimensional views of the two-dimensional relation.
66
67
68
Middleware to facilitate the development of multidimensional applications. (Software that converts the
two-dimensional relation into a multi-dimensional
structure).
Development of an option to create persistent, multidimensional structures with facilities to assist in the
administration of these structures.
69
70
71
72
73
74
75
76
77
Show the first six monthly sales for branch office B003
without the effect of seasonality.
SELECTmonth,monthlySales,
MOVINGAVG(monthlySales)
MonthMovingAvg,
MOVINGSUM(monthlySales)
MonthMovingSum
FROMBranchSales
WHEREbranchNo='B003';
AS
AS
78
79
80
81
82
83
84
Aggregations
85
86
87
88
89
90
91
Using MDX
92
Using MDX
93
Using MDX
94
MDX expression
95
SELECT
[Measures].[Sales] ON COLUMNS
[Time].[Wednesday] ON ROWS
FROM MySalesCube
WHERE [Region].[Washington].[Seattle]
AND [Product].[Vegetable].[Broccholi]
96
SELECT
97
http://msdn.microsoft.com/library/psdk/sql/aghtin
tro_2vov.htm.
98