The BEGIN QUERY LOGGING and REPLACE QUERY LOGGING statements give the administrator flexibility in determining what SQL requests are to be logged based on the user ID or account string and determines what level of detail is captured for a selected request. DBQL does not, however, allow for rules to be selective based on request type or object accessed. That is, DBQL logs all request types and target database objects. Therefore, the user ID and account string serve as the primary selection criteria.
DBQL logging is controlled at the system level by default. The following options are enabled by default:
- Detailed logging, which logs to DBC.DBQLogTbl and view DBC.QryLogV. The system automatically moves the log content stored in DBC.DBQLogTbl to td_metric_svc Database. These logs can be viewed using td_metric_svc.dbqlogV view.
- SQL logging, which logs to DBC.DBQLSqlTbl and view DBC.QryLogSqlV. The system automatically moves the log content stored in DBC.DBQLSQLTbl to td_metric_svc Database. These logs can be viewed using td_metric_svc.dbqlsqlV view.
- Utility logging, which logs to DBC.DBQLUtilityTbl and view DBC.QryLogUtilityV. The system automatically moves the log content stored in DBC.DBQLUtilityTbl to td_metric_svc Database. These logs can be viewed using td_metric_svc.dbqlutilityV view.
- For Feature Use Logging analysis, create the following custom views:
REPLACE VIEW td_metric_svc.FeatureUseCountV AS SELECT CAST(B.FEATURENAME AS CHAR(100)) AS FEATURENAME, SUM(GETBIT(A.FEATUREUSAGE,(2047 - B.FEATUREBITPOS))) AS FEATUREUSECOUNT FROM td_metric_svc.dbqlogV A, DBC.QRYLOGFEATURELISTV B GROUP BY B.FEATURENAME;REPLACE VIEW td_metric_svc.FeatureUseJSONV AS LOCKING TABLE td_metric_svc.dbqlogV FOR ACCESS select JsonTbl.QueryID (FORMAT '--Z(17)9'), CAST(JsonTbl.FeatureUsageJSON as JSON) FeatureUsageJSON from table (TD_SYSFNLIB.TD_DBQLFUL(td_metric_svc.dbqlogV.QueryID,td_metric_svc.dbqlogV.FeatureUsage)) as JsonTbl;Use the custom views to access feature use logging. See Changing DBQL Rules for Specific Users or Accounts
- If you want to continue using other logging options you can do so by adding appropriate rules.If enabling XMLPLAN, LOCK, or PARAMINFO, the user assumes the responsibility for managing the corresponding DBC tables:
- DBC.DBQLXMLTbl
- DBC.DBQLXMLLockTbl
- DBC.DBQLParamTbl
If a Teradata dynamic workload management software exception occurs, the Teradata dynamic workload management software causes rows to be written to the DBQLSqlTbl.
For information on this type of an exception, see Teradata Dynamic Workload Management API Features or use Teradata Viewpoint.