SQL Logging Statements | Teradata Vantage - SQL Logging Statements - Analytics Database - Teradata Vantage

Database Administration

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2024-10-04
dita:mapPath
pgf1628096104492.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
ujp1472240543947
lifecycle
latest
Product Category
Teradata Vantage™

When creating the necessary rules to enable SQL logging using DBQL, a rule correlates exactly to a specific SQL statement. For example, the following SQL statements show a BEGIN QUERY LOGGING statement along with its corresponding END QUERY LOGGING statement.

BEGIN QUERY LOGGING WITH SQL ON ALL ACCOUNT='$M00MSIR&D&H';
   END QUERY LOGGING WITH SQL ON ALL ACCOUNT='$M00MSIR&D&H';

The implication is that the SQL used to create the various rules should be retained so as to easily facilitate removing a rule.

The preceding account string format is considered a best practice. For more information, see Logging Resource Usage Data with Account String Variables.

All rules can be easily removed by the following command:

END QUERY LOGGING ON ALL RULES;
Support will be removed for the WITH option of the END QUERY LOGGING statement. Use of the option results in the following message: “Deprecated option WITH is used and will soon be removed. Do not continue to use WITH option, refer to END QUERY LOGGING statement syntax.”