Primary keys for table joins

Primary keys and usage examples for joining tables in your Performance History Database.

CQM_SUMM_METRICS and CQM_SUMM_TEXT joins

Primary key
TEXT_TOKEN
Note: The TEXT_TIMESTAMP column in CQM_SUMM_TEXT is reserved for internal use only.
Example
--SELECT COUNT (*) FROM SYSTOOLS.CQM_SUMM_METRICS A,
--     SYSTOOLS.CQM_SUMM_TEXT B
--WHERE A.TEXT_TOKEN = B.TEXT_TOKEN ;

CQM_EXCEPTIONS and CQM_EXCP_TEXT joins

Primary key
EXCEPTION_TIMESTMP
In the CQM_EXCEPTIONS table.
TEXT_TIMESTAMP
In the CQM_EXCP_TEXT table.
Example
--SELECT COUNT(*) FROM SYSTOOLS.CQM_EXCEPTIONS A,
--     SYSTOOLS.CQM_EXCP_TEXT B
--WHERE A.EXCEPTION_TIMESTMP = B.TEXT_TIMESTAMP;

CQM_SQLCODE_DET and CQM_SQLCODE_TEXT joins

Primary keys
If the text token is not 0 (dynamic text):
SQLCODE_TIMESTAMP
In the CQM_SQLCODE_DET table.
TEXT_TIMESTAMP
In the CQM_SQLCODE_TEXT table.
If the text token is 0 (static text), you can retrieve the text from the DB2 Catalog.
Example - Dynamic text
--SELECT COUNT(*) FROM SYSTOOLS.CQM_SQLCODE_DET A,
--     SYSTOOLS.CQM_SQLCODE_TEXT B
--WHERE A.SQLCODE_TIMESTAMP = B.TEXT_TIMESTAMP;
Example - Static text
--SELECT TEXT
--     ,SEQNO
--  FROM SYSIBM.SYSPACKSTMT
--  WHERE NAME = program
--   AND PLNAME = plan
--   AND SECTNO = section number
--   AND STMTNO = statement number;
Note:
  1. Lower case values can be extracted from the CQM_EXCEPTIONS table or the CQM_SQLCODE_DET table.
  2. If the text token is all X'FF', then OPTKEYS TEXT is not specified and Db2 Query Monitor will not store the dynamic text.

CQM_EXCP_HOSTV and CQM_EXCEPTIONS joins

Primary key
EXCEPTION_TOKEN
Example
--SELECT COUNT(*) FROM SYSTOOLS.CQM_EXCP_HOSTV A,
--     SYSTOOLS.CQM_EXCEPTIONS B
--WHERE A.EXCEPTION_TOKEN = B.EXCEPTION_TOKEN;

CQM_EXCP_CALLS and CQM_EXCEPTIONS joins

Primary key
EXCEPTION_TOKEN
Example
--SELECT * FROM SYSTOOLS.CQM_EXCP_CALLS A,
--     SYSTOOLS.CQM_EXCEPTIONS B
--WHERE A.EXCEPTION_TOKEN = B.EXCEPTION_TOKEN;

CQM_EXCP_OBJS and CQM_EXCEPTIONS joins

Primary key
EXCEPTION_TOKEN
Example
--SELECT * FROM SYSTOOLS.CQM_EXCP_OBJS A,
--     SYSTOOLS.CQM_EXCEPTIONS B
--WHERE A.EXCEPTION_TOKEN = B.EXCEPTION_TOKEN;

CQM_SUMM_METRICS and CQM_SUMM_OBJECTS joins

Primary key
METRICS_TOKEN
Example
--SELECT * FROM SYSTOOLS.CQM_SUMM_METRICS A,
--     SYSTOOLS.CQM_SUMM_OBJECTS B
--WHERE A.METRICS_TOKEN = B.METRICS_TOKEN;