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

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
wgr1555383704548.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

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;