Example: Searching Multiple Levels of the DBQL Rules Hierarchy - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

These examples show how SHOW QUERY LOGGING requests report query logging rules when a rule cannot be matched at the first search level in the rules hierarchy. See Example: Report DBQL Rule that Logs All Users for All Accounts Using Default Logging through Example: Report DBQL Rule that Logs All Queries for MultiLoad Utility.

Assume the following query logging rules were created in DBC.DBQLRulesTbl. Except for differences in the specified logging options (see Rules 2, 3, and 5), these logging rules are identical to those for Example: SHOW QUERY LOGGING for Simple Conditions.

  1. BEGIN QUERY LOGGING ON ALL;

    This request creates a logging rule for all users and all accounts using default logging.

    The row for Rule 1 in DBC.DBQLRules is as follows.

        Rule UserName   "ALL" (From an ALL rule)
          Rule UserId   00000000
              Account   (Rule for any Account)
    
           DBQL RULE:
              Explain   F
               Object   F
                  SQL   F
                 Step   F
              XMLPlan   F
           StatsUsage   F
             UseCount   F
                Param   F
              Verbose   F
         StatsDetails   F
          UtilityInfo   F
              Summary   F
            Threshold   F
      Text Size Limit   200 
  2. BEGIN QUERY LOGGING WITH OBJECTS ON ALL ACCOUNT = 'finance';

    This request creates a logging rule for all users logged on under account name finance and logs objects.

    The row for Rule 2 in DBC.DBQLRules is as follows.

        Rule UserName   "ALL" (From an ALL rule)
          Rule UserId   00000000
              Account   FINANCE
    
           DBQL RULE:
              Explain   F
               Object   F
                  SQL   F
                 Step   F
              XMLPlan   F
           StatsUsage   F
             UseCount   F
                Param   F
              Verbose   F
         StatsDetails   F
          UtilityInfo   F
              Summary   F
            Threshold   F
      Text Size Limit   200 
  3. BEGIN QUERY LOGGING WITH STEPINFO ON user1 ACCOUNT = 'marketing';

    This request creates a logging rule for user1 when that user is logged on under account name marketing and logs step information.

    The row for Rule 3 in DBC.DBQLRules is as follows.

        Rule UserName   user1
          Rule UserId   00001244
              Account   MARKETING
    
           DBQL RULE:
              Explain   F
               Object   F
                  SQL   F
                 Step   F
              XMLPlan   F
           StatsUsage   F
             UseCount   F
                Param   F
              Verbose   F
         StatsDetails   F
          UtilityInfo   F
              Summary   F
            Threshold   F
      Text Size Limit   200 
  4. BEGIN QUERY LOGGING ON user1 ACCOUNT = 'hr';

    This request creates a logging rule for user1 when that user is logged on under account name hr using default logging.

    The row for Rule 4 in DBC.DBQLRules is as follows.

        Rule UserName   user1
          Rule UserId   00001244
              Account   HR
    
           DBQL RULE:
              Explain   F
               Object   F
                  SQL   F
                 Step   F
              XMLPlan   F
           StatsUsage   F
             UseCount   F
                Param   F
              Verbose   F
         StatsDetails   F
          UtilityInfo   F
              Summary   F
            Threshold   F
      Text Size Limit   200 
  5. BEGIN QUERY LOGGING WITH SQL ON user1;

    This request creates a logging rule for user1 when that user is logged on under any account name and logs SQL.

    The row for Rule 5 in DBC.DBQLRules is as follows.

        Rule UserName   user1
          Rule UserId   00001244
              Account   (Rule for any Account)
    
           DBQL RULE:
              Explain   F
               Object   F
                  SQL   F
                 Step   F
              XMLPlan   F
           StatsUsage   F
             UseCount   F
                Param   F
              Verbose   F
         StatsDetails   F
          UtilityInfo   F
              Summary   F
            Threshold   F
      Text Size Limit   200 
  6. BEGIN QUERY LOGGING WITH NONE ON APPLNAME = 'multload';

    This request creates a logging rule for the MultiLoad application with no logging.

    The row for Rule 6 in DBC.DBQLRules is as follows.

    Rule UserName  "ALL"
    Rule UserId     00000000
    Account        (Rule for any Account)
    ApplicationName   MULTLOAD
    WITH NONE         (No DBQL Logging)

The hierarchy for these rules is the same as that for the first example set, as follows.

Hierarchy Level Rule Number
1 6
2 3
3 4
4 5
5 2
6 1