MQT
A Materialized Query Table (MQT) is a table that is defined on the result of a SQL statement. It is generally used to avoid repetitive calculations by storing pre-computed aggregated results in the table. If the Db2 database manager determines that a portion of an SQL statement can be resolved using an MQT, the database manager will rewrite the access plan to use the appropriate MQT on behalf of a regular base table. This process is very transparent to the application or the end user.
It is a two-step process to create and maintain an MQT. First, create an MQT based on the needs of the business logic, and then refresh the data in the MQT table. If you want to build an MQT to record the SUM of SALES_AMOUNT for each SALES_DATE, you can ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access