|
|
Archives of the TeradataForum
Message Posted: Tue, 03 Dec 2013 @ 20:16:23 GMT
Subj: | | Re: Query Logging for all users |
|
From: | | Clark, Dave |
Below are some useful queries that I use to find out what DBQL rules exist .
Hope it helps!
-dave.clark
.set sidetitles on
.set foldline
SEL * FROM DBC.DBQLRules;
SELECT UserName (format 'x(10)',TITLE 'Logged Users')
,AccountString (format 'x(18)')
FROM DBC.DBQLRules
ORDER BY 1,2;
SELECT UserName (TITLE 'Non-Logged Users')
,DefaultAccount (TITLE 'Account')
FROM DBC.Users
WHERE (UserName, DefaultAccount) NOT IN (
SEL Username, AccountString from DBC.DBQLRules)
AND (UserName, '') NOT IN (
SEL Username, AccountString from DBC.DBQLRules)
AND ('All', DefaultAccount) NOT IN (
SEL Username, AccountString from DBC.DBQLRules)
ORDER BY 1,2;
SELECT UserName (format 'X(10)',TITLE 'Logged Users')
,DBQLRuleTbl.AccountString (format 'X(12)', Title 'Account')
,DBQLRuleTbl.SQLFlag (Format 'X',Title 'SQL')
,DBQLRuleTbl.TextSizeLimit (Format 'ZZZZ9', Title 'SQL//Size')
,DBQLRuleTbl.ExplainFlag (Format 'X',Title 'Exp')
,DBQLRuleTbl.ObjFlag (format 'X',Title 'Obj')
,DBQLRuleTbl.StepFlag (format 'X',Title 'Stp')
,DBQLRuleTbl.ThresholdFlag (Format 'X',Title 'Thr//Set')
,DBQLRuleTbl.SummaryFlag(Format 'X',Title 'Sum//Set')
,CASE
WHEN DBQLRuleTbl.TypeOfCriterion= 0 THEN 'ElapsedSec'
WHEN DBQLRuleTbl.TypeOfCriterion= 1 THEN 'CPUTime (centisec)'
WHEN DBQLRuleTbl.TypeOfCriterion= 2 THEN 'IOCount'
WHEN DBQLRuleTbl.TypeOfCriterion= 3 THEN 'CPUTimeNorm (centisec)'
WHEN DBQLRuleTbl.TypeOfCriterion= 4 THEN 'ElapsedTime (centisec)'
ELSE 'NO CRITERION'
END (TITLE 'Threshold//Trigger')
,DBQLRuleTbl.SummaryVal1(Format 'ZZ9', Title 'Sum//Low')
,DBQLRuleTbl.SummaryVal2(Format 'ZZ9',Title 'or//Med')
,DBQLRuleTbl.SummaryVal3(Format 'ZZZ9',Title 'Thr//High')
FROM DBC.DBQLRules
ORDER BY 1,2;
| |