Learn more about the materialized views of DB2

Source: Internet
Author: User

The DB2 Materialized View (MQT) is a special type of view. The following describes the materialized view of DB2 for your reference. It is helpful for you to learn about the DB2 database.

MQT can be considered as a materialized view. Both the view and MQT are defined based on a query. When a view is referenced, the view-Based Query runs. However, MQT actually saves the query results as data. You can use the data in MQT instead of the data in the underlying table.

Materialized query tables can significantly improve query performance, especially the performance of complex queries. If the optimizer determines that a part of the query can be solved using an MQT, the query will be rewritten to use MQT. MQT can be defined when a table is created, system-maintained MQT, or user-maintained MQT.

When creating the DB2 materialized view maintained by the system, you can specify whether the table data is refresh immediate or refresh deferred. You can use the REFRESH keyword to specify how to maintain data. DEFERRED means that the data in the TABLE can be refreshed at any time through the refresh table statement. Whether it is refresh deferred or the MQT maintained by the refresh immediate system, the insert, update, or delete operations on them are not allowed. However, for the refresh immediate-type MQT maintained by the system, you can update it by performing the insert, update, or delete operation on the underlying table.

 
 
  1. create table course_query as   
  2. (   
  3. select courseware_id, other_courseware_name from   
  4. (   
  5. select distinct courseware_id, other_courseware_name   
  6. from metadata   
  7. where other_courseware_name in   
  8. (   
  9. select distinct Other_courseware_name   
  10. from METADATA   
  11. where is_delete like '0'   
  12. )   
  13. )    
  14. )  
  15. data initially deferred refresh deferred;  
  16. refresh table course_query;  

DB2 logfilsiz parameter settings

DB2 command line connection

Implementation of DB2 circular Query

How to view DB2 dynamic SQL statements

Learn about the DB2 Index Structure

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.