Materialized Query Tables Wizard (DB2 LUW)
Go Up to IBM DB2 for Linux, Unix, and Windows Object Wizards
A materialized query table (MQT) is a table based on the result of a query. An MQT contains information that is summarized from other tables and can save time when processing dynamic SQL queries. The Materialized Query Table wizard lets you create a table without knowing the underlying commands.
To Open the Materialized Query wizard
- On the Navigator/Explorer, find the datasource where you want to add the new materialized query table.
- Expand the Schema branch, right-click Materialized Query Tables, and then select New.
The following table describes the fields you may encounter as you complete the Materialized Query Table wizard.
Note: These options are only available if the tablespace you selected is a database managed tablespace.
| Required Information | Description |
|---|---|
|
Who owns the table? |
Choose the owner of the table you are creating from the drop-down list. |
|
What is the name of the table? |
Type the name of the materialized query table you are creating. |
|
Select a tablespace on which to place the table: |
Optional. No selection is the default. But you can select a tablespace that belongs to the new table's owner if you want. |
|
Specify separate tablespaces for index and long data |
Optional. Lets you separate indexes or long data from the table. Indexes Long data. |
|
Specify the query on which this table is based |
Write the query you want to use to create the table.
|
|
Add the columns belonging to this table Add the columns belonging to the partition key |
Click Add, Insert or Edit to add or modify table columns. Click Drop to delete a selected column. |
|
Do you want the table replicated across database partitions? |
The default is no, but check the box if you do want to replicate the table. Replicated materialized query tables can help you improve query performance by enabling collocation between tables. Replication is especially helpful when you have joins between large fact tables and small dimension tables. It's best if tables that are to be replicated are infrequently updated. |
|
Definition Only |
Lets you select definition options, Include Column Defaults and Include Identity Column Attributes. When you select Definition Only, the new table is treated as if it was a base table rather than a MQT. After you complete the wizard, the Tables Editor opens. |
|
Refreshable |
Lets you select refresh options:
After you complete the wizard, the Material Query Tables Editor opens. |
|
Would you like extra information regarding SQL changes to this table to be written to the log? |
If you opted to replicate the table, you must make a selection here.
|
|
Would you like to skip logging changes made to this table by Insert... and Alter Table operations in the same unit of work in which this table is created? |
|
|
What type of table lock would you like when it is being accessed? |
|
|
What percent of free space to leave for load and reorganization? |
-1 is the default. |
|
Do you want data to append to the end of the table? |
|
|
Do you want the access plan to this table to be based on existing statistics and optimization level? |
|
|
Enter a comment |
Optional. |