17.10 - Example: Short Requests Based on CPU Time - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

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

As an alternative to using SUMMARY or THRESHOLD options for short duration requests, specify the CPUTIME option. You can save the count only or fully log request information based on the number of CPU seconds required to complete a request.

This request counts the number of requests for user_1 during a session in each of the CPU second intervals specified:

     BEGIN QUERY LOGGING LIMIT SUMMARY=100, 200, 300 CPUTIME ON user_1;

CPUTIME intervals are created in units of 0.01 seconds of CPU time. This query specifies these intervals:

  • 0 - 1 CPU seconds
  • 1 - 2 CPU seconds
  • 2 - 3 CPU seconds
  • >3 CPU seconds

This request creates a rule to increment the query counter in DBQLSummaryTBL for requests in a session for user_1 taking less than 100 CPU seconds and to log a complete DBQL entry in DBQLogTbl for requests over 100 CPU seconds:

     BEGIN QUERY LOGGING LIMIT THRESHOLD=100 CPUTIME ON user_1;