Database Reference
In-Depth Information
a
RowID
Product
Product
Key
Product
Name
...
Discontinued
...
1
p1
prod1
...
No
...
2
p2
prod2
...
Yes
...
3
p3
prod3
...
No
...
4
p4
prod4
...
Yes
...
5
p5
prod5
...
No
...
6
p6
prod6
...
Yes
...
b
c
d
RowID
Sales
Product
Key
Customer
Key
Time
Key
Sales
Amount
RowID
Sales
RowID
Product
Yes No
0
1
p1
c1
t1
100
1
1
1
2
p1
c2
t1
100
2
1
0
1
3
p2
c2
t2
100
3
2
1
0
4
p2
c2
t3
100
4
2
1
0
5
p3
c3
t3
100
5
3
0
1
6
p4
c3
t4
100
6
4
1
0
7
p5
c4
t5
100
7
5
0
1
Fig. 7.12
An example of a join and a bitmap join indexes. (
a
)
Product
dimension
table. (
b
)
Sales
fact table. (
c
) Join index. (
d
) Bitmap join index on attribute
Discontinued
attribute
Discontinued
('
Yes
'or'
No
'). A query like the one above will be
answered straightforwardly since we have precomputed the join between the
two tables and the bitmap over the attribute
Discontinued
.
In the next section, we will show how bitmap and join indexes are used in
query evaluation.
7.6 Evaluation of Star Queries
Queries over star schemas are called
star queries
since they make use of
the star schema structure, joining the fact table with the dimension tables.
For example, a typical star query over our simplified Northwind example in
Sect.
7.3
would be “Total sales of discontinued products, by customer name
and product name.” This query reads in SQL:
SELECT C.CustomerName, P.ProductName, SUM(S.SalesAmount)
FROM SalesS,CustomerC,ProductP
WHERE S.CustomerKey = C.CustomerKey AND
S.ProductKey = P.ProductKey AND P.Discontinued =
'
Yes
'
GROUP BY C.CustomerName, P.ProductName
Search WWH ::
Custom Search