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.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.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;