Stefano Paraboschi, Università di Bergamo Italy Italy Italy Spain
ItalyGiuseppe Sindoni, National Institute of Statistics
ItalyElena Baralis, Politecnico di Torino
ItalyErnest Teniente, Universitat Politècnica de Catalunya
This chapter presents materialized views in the context of multidimensional databases (MDDBs). A materialized view is a view whose content is explicitly stored in the database. The advantage of materializing views is that it is not necessary to recompute the query every time the view is accessed. The shortcoming is that it has to be kept consistent with the updates on the base tables. However, efficient incremental maintenance techniques have been proposed. MDDBs are an ideal environment for materialized views because frequency of updates is low, MDDB data models permit easy adoption of incremental maintenance, and queries can be modeled in such a way to allow an easy definition of the view selection problem, i.e., the problem of selecting which query to materialize in an MDDB. Hence, we present the problems of choosing and maintaining materialised views with the corresponding solutions.
Views are database objects whose content is derived from data stored in the database. A view V can be considered as the result of the computation of a function f on the database state DB: V = f(DB). In relational databases a view has the same structure of a relation, as it is labeled with a name (unique in the database schema among all tables and views), it is characterized by a set of attributes, and its instance consists of a set of tuples; the only difference is that its content is obtained executing a query on the database, and it is not explicitly created by database users.
Example 1: View TOTALSALES has two attributes Product and TotalAmount and each tuple presents the sum of the amounts of all the sales for a particular product.
create view TotalSales(Product,TotalAmount) as select Product, sum(Amount) from Sales group by Product
Views have an important role in databases, as they are at the core of many significant database services. Using views, a database schema can be adapted to the needs of the different users of the database. Data independence, one of the main advantages of databases (Atzeni et al., 1999), is implemented at the logical level by means of views; when the database schema evolves, views are used to emulate previous schema versions, making the application code independent of the actual relational schema.