BEGIN/REPLACE/END QUERY LOGGING Statements - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The purpose of each of the Teradata SQL DDL statements used to enable and disable DBQL logging is described in the following table.

Statement Purpose
BEGIN QUERY LOGGING When submitted by a user with EXECUTE privilege on DBQLAccessMacro, this statement enables logging for the named users, accounts, and applications triplet.
Log only a maximum of:
  • 100 users
  • One user with 100 accounts
  • 100 applications

per statement. If logging is to be enabled for more than 100 users, use blocks of BEGIN QUERY LOGGING statements with 100 users each. For active sessions, logging begins when Analytics Database gets the next query.

You can also enable a rule to make sure no logging takes place for a user, account, or application name.

For more information, see Logging Scenarios.

REPLACE QUERY LOGGING When submitted by a user with EXECUTE privilege on DBQLAccessMacro, this statement enables logging and deletes the existing rule in the DBC.DBQLRuleTbl table if one matches the users, accounts, applications triplet, and then creates a new rule. If no rule exists, the new rule is added to the DBC.DBQLRuleTbl table.
END QUERY LOGGING When submitted by a user with EXECUTE privilege on DBQLAccessMacro, this statement stops logging for the named users, accounts, or applications. Each END QUERY LOGGING statement must list fewer than 100 users/ 100 accounts for one user/ 100 applications. DBQL calls a routine that commits the data and flushes all the DBQL caches.

Each time you issue an END QUERY LOGGING statement, the system flushes the rules cache and DBQL data tables.

See Effects of Dynamically Enabling/Replacing/Disabling Logging on Current Rules.

FLUSH QUERY LOGGING The DBQL caches can be flushed when desired. See Flushing the DBQL Caches Manually.

Every BEGIN QUERY LOGGING statement you enable must be disabled using the proper END QUERY LOGGING statement syntax. For example, if you submit:

BEGIN QUERY LOGGING WITH SQL ON user1 ACCOUNT='Marketing';

you must use the following syntax to end logging for that user:

END QUERY LOGGING ON user1 ACCOUNT='Marketing';

If you list more than one account, use parentheses. For example, ACCOUNT= ('Marketing', 'Finance').

To enable other users to submit these statements, see Granting DBQL Administrative Privileges to Other Users.