15.10 - Example: Short Requests Based on CPU Time - Teradata Database

Teradata Database SQL Data Definition Language Syntax and Examples

prodname
Teradata Database
vrm_release
15.10
created_date
December 2015
category
Programming Reference
featnum
B035-1144-151K

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;