17.05 - Example: Invoking and Disabling Query Logging for a Rule Set - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1144-175K
Language
English (United States)

Logging for myuser2 changes as rules are successively disabled by submitting END QUERY LOGGING requests.

(Rule 1) Summary logging for any user, any account:

     BEGIN QUERY LOGGING LIMIT SUMMARY = 1,5,10 CPUTIME ON ALL ; 

These requests create the following two new rules in DBC.DBQLRuleTbl:

  • (Rule 2) Log default information and SQL for any user with specific account 'sales'
  • (Rule 3) Do not log for myuser2 with specific account 'sales'
         BEGIN QUERY LOGGING WITH SQL ON ALL ACCOUNT='sales';
         BEGIN QUERY LOGGING  WITH NONE ON  myuser2 ACCOUNT = 'sales';

This request creates the following two additional new rules in DBC.DBQLRuleTbl:

  • (Rule 4) Log default, SQL and objects for myuser2, any account
  • (Rule 5) Log default, SQL and objects for myuser3, any account
         BEGIN QUERY LOGGING WITH SQL, OBJECTS ON myuser2, myuser3;  

The following query logging activity results from these rules:

  1. User myuser2 logs on with account 'sales', so Rule 3 applies and no logging occurs.
  2. This request removes Rule 2, but myuser2:'sales ' continues to use Rule 3:
         END QUERY LOGGING on ALL ACCOUNT='sales';
  3. This request removes Rule 3, so myuser2:'sales' begins to log queries using Rule 1 with the summary log instead of using Rule 3 as before:
         END QUERY LOGGING myuser2  ACCOUNT='sales';