130 likes | 230 Views
INFORMATION INTEGRATION. ANAND KANANKAM CS-257 ID- 122. DATA CUBES. Data cube is a multi-dimensional structure , it as a data abstraction that allows one to view aggregated data from a number of perspectives.
E N D
INFORMATION INTEGRATION ANAND KANANKAM CS-257 ID- 122
DATA CUBES • Data cube is a multi-dimensional structure , it as a data abstraction that allows one to view aggregated data from a number of perspectives. • It is surrounded by a collection of sub-cubes/cuboids that represent the aggregation of the base cuboid along one or more dimensions.
CUBE OPERATOR • In cube operator, we can define an augmented table CUBE(F) that add an additional value, denoted *, to each dimension. • The * has the intuitive meaning “any”, and it represents aggregation along the dimension in which it appears.
EXAMPLE: Sales(model , color, date, dealer, val , cnt). -In this query we specify conditions on certain attributes of the sales relation and group by some other attributes -In the relation CUBE(sales), we look for those tuples t with the following properties: 1. If the query specifies a value v for attribute a, then tuple t has v in its component for a.
2.If the query groups by an attribute a, then t has any non-* value in its component for a. 3.If the query neither groups by attribute a nor specifies a value for a, then t has * in its component for a. QUERY: SELECT color, AVG(price) FROM Sales WHERE model=‘Gobi’ GROUP BY color; Cube(Sales) Form is (‘Gobi’ ,c ,*,*,v ,n)
CUBE IMPLEMENTED BY MATERIALIZED VIEWS • A materialized view is an object that stores the result of select statement. These are mostly used in data warehousing to improve the performance of the select statements that involve group and aggregate functions we use materialized views . EXAMPLE: INSERT INTO salesV1 SELECT model, color, month, city, SUM(val) AS val, SUM(cnt) AS cnt FROM sales JOIN Dealers ON dealer=name GROUP BY model , color , month, city; Sales(model, color, date, dealer, val, cnt)
Query:SELECT model ,SUM(val) FROM sales GROUP BY model; -Can also be written as: SELECT model, SUM(val) FROM sales(v1) GROUP BY model;
SELECT model, color, date, SUM(val) FROM sales GROUP BY model ,color , date;
LATTICE OF VIEWS • In lattice view we can partition the values of a dimension by grouping according to one or more attributes of its dimensional tables.