Performance enhancements with the JOIN keyword
The CM/PILOT component supports the use of the JOIN keyword, which can significantly reduce the execution time of a DML statement that searches multiple tables.
The following rules govern the use of the JOIN keyword:
- The JOIN keyword must follow the object type in the DML statement and must precede a SET, INCLUDE, or WHERE clause.
- You can use either the actual Db2 catalog names or the CM/PILOT DML object-type keywords with the JOIN keyword and in the WHERE clause.
- You must use name prefixes if ambiguity exists in the DML statement. In the preceding example, name prefixes are required because the DBNAME attribute is common to both of the catalog tables that are used in the WHERE clause.
- You can use the JOIN keyword only to improve the performance of the WHERE clause. You cannot update any attribute of the specific catalog table following the JOIN keyword. For example, an error will occur in the example shown in the following figure because the SQTY attribute is not an attribute of TABLESPACES (SYSIBM.SYSTABLESPACE).
Incorrect use of the JOIN keyword
MIGRATE TABLESPACES
JOIN TABLEPARTS
SET CREATOR = 'ABCD',
SQTY = 123
WHERE TABLEPARTS.DBNAME = TABLESPACES.DBNAME AND
TSNAME = NAME AND
STORNAME = 'ABCDEFG';
JOIN TABLEPARTS
SET CREATOR = 'ABCD',
SQTY = 123
WHERE TABLEPARTS.DBNAME = TABLESPACES.DBNAME AND
TSNAME = NAME AND
STORNAME = 'ABCDEFG';
DML for migrating table spaces
DML for migrating table spaces with a JOIN
DML for replicating changes in multiple databases
DML for replicating work IDs to multiple databases
Related topic
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*