You are on page 1of 2

Database query logging (DBQL) is an optional feature in Teradata through which we can track processing behavior of database by logging

user activity.
ser activity can be logged in various level na!ely ob"ect# sql te$t# steps# e$plain etc. one can also set li!it to the length of query te$t to be logged.
since this is resource consu!ing task that database has to perfor! on each activity# on should assess i!pact on database perfor!ance before enabling it in
various level.
Query logging can be enabled on user using its account na!e. %very user created in database has its account na!e (account string) assigned while user
creation# though account string can be assigned to a user or group of user !anually.
&ccount string of a user can be verified by querying "dbc.accountinfo" view or better edit profile to check account string.
select * from dbc.accountinfo where username =username
The DBQL can be enable for specific user using their account string by below co!!and
begin query logging with explain,objects, sql on all account=( !"!#$%&!%!'!()
in the above co!!and query logging will be enabled for ob"ects# sql te$t and e$plain on all user having account *!"!#$%&!%!'!( . There are few
!ore detail option for query logging is available na!ely step logging# $!l e$plain# su!!ery logging. The te$t si'e of sql te$t can be li!it by li!it clause
as below. (ere ) !eans unli!ited whereas any positive integer will li!its to its value.
begin query logging with explain,sql limit sqltext=+ on all account=( !"!#$%&!%!'!()
Query logging can be disable with end query logging co!!and as show below.
end query logging with explain,objects, sql on all account=( !"!#$%&!%!'!()
DBQL can be enabled for all users irrespective of their account string by below co!!and
#egin query logging with objects, sql limit sqltext=+ on all
*inally DBQL rules can be verified by querying "dbc.dbqlrules" view.
select * from dbc.dbqlrules
Deleting DBQL Logs:
*inally# these + queries are used for deleting DBQL Logs in order to create free space in the database.
Del dbc.dbqlogtbl
Del dbc.DBQLSqlTbl
,t is a TD Tool that provides the ability to store# the historical records of queries based on rules we specify# for analysis. Query -ecords such as
1. DURATION,
2. PERFORMANCE,
3. QUERY COUNTS,
4. RESPONSE TIMES,
5. TARGET ACTIVITY
.QL and /rocessing .teps can be co!pared in order to *ine0 Tune queries for 1pti!u! /erfor!ance.
,t is *le$ible enough so that it can be custo!i'ed to log ,nfor!ation based on the .%- or Q%-2 requests ranging fro! .hort
Transactions to Longer0 -unning &nalysis and 3ining Queries.
DBQL data can be input to TL% and Teradata Tools and tilities# including TD 3anager# 4 TD 5%.
6e can specify that the recording criteria be a !i$ of7
o sers and accounts
o %lapsed ti!e# where ti!e can be e$pressed as7
& series of intervals
& threshold li!it
o /rocessing detail# including any or all7
1b"ects
.teps
.QL te$t
,n addition to the query0related data# DBQL also stores the following infor!ation to help identify
the query7
ser na!e
.ession nu!ber and account infor!ation

You might also like