Query Logging User Rules | BEGIN QUERY LOGGING | Teradata Vantage - Query Logging User Rules - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
jbg1472252759029
lifecycle
latest
Product Category
Teradata Vantage™

Because you can log different information for different users, the system table DBC.DBQLRuleTbl maintains the various logging rules for each user. These rules are based on the logon account string for each logged user and are maintained in cache to promote their quick access.

This topic does not describe the rules hierarchy, but can be helpful for understanding default accounts and DBQL rules. See Hierarchy of Applying Database Query Logging Rules.

You must access the DBC.DBQLRulesV view. You cannot access either DBC.DBQLRuleTbl or DBC.DBQLRuleCountTbl directly.

Sessions are always associated with an account. At logon, the session is associated with the default account of the user who is logging on unless the logon string for that user specifies a different account assignment. See the logon pointer information in Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems, B035-2418.

DBQL searches for rules in the following order:
  1. Local cache.
  2. Rules database.

Assume that user1 has a default account of abc, but is also assigned to account def and that you have submitted the following BEGIN QUERY LOGGING requests:

BEGIN QUERY LOGGING ON ALL ACCOUNT = 'ABC';

BEGIN QUERY LOGGING WITH OBJECTS ON user1 ACCOUNT = 'def';

In this scenario, if a user does not specify an account string when logging on, then the system applies the ALL rule instead of the user1 rule.

IF user1 logs on … THEN the following rule applies …
specifying account def user1.

The system uses the rule specified by the following request to log the user1 queries and to log objects for those queries.

     BEGIN QUERY LOGGING WITH OBJECTS
       ON user1
       ACCOUNT =  'def ';
without specifying an account ALL.

The system uses the rule specified by the following request to log the user1 queries, but does not log object information about them.

BEGIN QUERY LOGGING
  ON ALL
  ACCOUNT =  'abc ';