{"id":2687,"date":"2018-09-10T07:00:37","date_gmt":"2018-09-10T07:00:37","guid":{"rendered":"http:\/\/dbtut.com\/?p=2687"},"modified":"2018-12-06T08:46:11","modified_gmt":"2018-12-06T08:46:11","slug":"dbql-rules-query-logging","status":"publish","type":"post","link":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/","title":{"rendered":"DBQL rules &#8211; QUERY LOGGING"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>Following query will verify if any DBQL rule exists:<\/p>\n<p>locking table DBC.DBQLRuleTbl for access<\/p>\n<pre class=\"lang:default decode:true \">select * from DBC.DBQLRuleTbl;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Note:<\/strong> View DBC.DBQLRules OR DBC.DBQLRulesV can also be used in above query.<\/p>\n<p>&nbsp;<\/p>\n<p>To review existing DBQL rules you can either use &#8220;SHOW QUERY LOGGING&#8221;<\/p>\n<p>or<\/p>\n<p>Use DBC tables\/view mentioned earlier (e.g DBC.DBQLRuleTbl).<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">SHOW QUERY LOGGING\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ ALL [ ACCOUNT = ('account id' [ ... ,'account id' ] ) ] }\r\n\r\nON\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ user-name [ ACCOUNT = ('account id' [ ... ,'account id' ] ) ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ user-name [ ... ,user-name ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ database-name [ ... ,database-name ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ APPLNAME = ('application-name' [ ... ,'application-name' ] ) } ;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">show query logging on all;\r\n\r\nshow query logging on username;\r\n\r\nshow query logging on all account = 'accountname';\r\n\r\nshow query logging on username account = 'accountname';\r\n\r\nshow query logging on applname = 'multload';<\/pre>\n<p>&nbsp;<\/p>\n<p>To enable DBQL logging use &#8220;BEGIN QUERY LOGGING&#8221;.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">BEGIN QUERY LOGGING\r\n\r\n\u00a0 \u00a0 \u00a0[ WITH logging-option [ ... ,logging-option ] ]\r\n\r\n\u00a0 \u00a0 \u00a0[ MODE = m ]\r\n\r\n\u00a0 \u00a0 \u00a0[ LIMIT limit-option [AND limit-option ] ]\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ ALL [ ACCOUNT = ('account id' [ ... ,'account id' ] ) ] }\r\n\r\nON\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ user-name [ ACCOUNT = ('account id' [ ... ,'account id' ] ) ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ user-name [ ... ,user-name ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ database-name [ ... ,database-name ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ APPLNAME = ('application-name' [ ... ,'application-name' ] ) } ;<\/pre>\n<p>&nbsp;<\/p>\n<p>where:<\/p>\n<p>logging-option is<\/p>\n<pre class=\"lang:default decode:true \">OBJECTS database, table, column and index information in DBQLObjTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0SQL log the full text of all SQL statements in DBQLSqlTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0STEPINFO log AMP step-level information in DBQLStepTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0EXPLAIN generate and log the 'Explain' for the query in DBQLExplainT\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0XMLPLAN log the query plan in XML format in DBQLXMLTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0LOCK=n log any lock contention that exceeds centiseconds\u00a0in XML format in DBQLXMLLOCKTbl. Minimum acceptable value for n is 5.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0STATSUSAGE log query optimizer statistics usage and recommendations\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0PARAMINFO log parameter information and data parcels into DBQLParamTbl\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0USECOUNT log object use counts.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0UTILITYINFO log utility information in DBQLUtilityTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0VERBOSE log verbose explain and related information in XML format,is a sub-option to XMLPLAN.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0DETAILED log summary stats details from the interval zero of the hist\u00a0for the existing stats on all objects referenced in the query\u00a0plan.It is a sub-option to STATSUSAGE option.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0NO COLUMNS Sub-option to the OBJECTS logging rule to control the logging\u00a0of column information.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0ALL log object, step information, explain, and SQL.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0NONE do not enable DBQL for specified application(s), user(s) or\u00a0account(s).\r\n\r\nLogging option ::= (ALL | EXPLAIN | [NO COLUMNS] OBJECTS | SQL | STEPINFO\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 PARAMINFO | [VERBOSE] XMLPLAN | [DETAILED] STATSUSAGE)\r\n\r\nMODE = m Use the CPU\/IO Collection algorithm specified by \"m\"<\/pre>\n<p>&nbsp;<\/p>\n<p>0 &#8211; Use default for this release<\/p>\n<p>1 &#8211; Use classic V2R6 algorithm 1 for step adjustments<\/p>\n<p>2 &#8211; Use AMP algorithm 2 (mainly diagnostic)<\/p>\n<p>3 &#8211; Use AMP algorithm 3 (aborted &amp; parallel steps)<\/p>\n<p>If MODE is specified, &#8220;m&#8221; (an integer) is required.<\/p>\n<p>If MODE is not\u00a0specified, mode is controlled by DBSControl general parameter for\u00a0&#8220;DBQL CPU\/IO Collection&#8221;.<\/p>\n<p>An ERRTEQDBQLMODENOTALLOWED (9573) is\u00a0returned on the SQL request if the user is not authorized to use.<\/p>\n<p>limit-option is<\/p>\n<pre class=\"lang:default decode:true \">\u00a0SQLTEXT[=n]\u00a0 \u00a0 \u00a0 \u00a0 \u00a0maximum number of SQL text characters in DBQLogTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Without n: 10,000 characters, n=0 no SQL.\r\n\r\n\u00a0 \u00a0 \u00a0SUMMARY=n1,n2,n3 [units]\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0count the number of queries for a session that fall\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0into each of four intervals for the DBQLSummaryTbl.\r\n\r\n\u00a0 \u00a0 \u00a0THRESHOLD[=n] [units]\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0queries that run in n 'units' or less are counted in\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0DBQLSummaryTbl; others are logged in DBQLogTbl.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Without n: 5 'units'\r\n\r\n\u00a0 \u00a0 \u00a0\u00a0 \u00a0 \u00a0 \u00a0units may be:\r\n\r\n\u00a0 \u00a0 \u00a0CPUTIME\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Summary or Threshold is based on CPU time\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0where n,n1,n2,n3 is specified in hundredths of\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0a second.\r\n\r\n\u00a0 \u00a0 \u00a0CPUTIMENORM\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Summary or Threshold is based on normalized CPU time\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0where n,n1,n2,n3 is specified in hundredths of\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0a second.\r\n\r\n\u00a0 \u00a0 \u00a0ELAPSEDTIME\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Summary or Threshold is based on elapsed time\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0where n,n1,n2,n3 is specified in hundredths of\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0a second.\r\n\r\n\u00a0 \u00a0 \u00a0IOCOUNT\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0Summary or Threshold is based on count of total IO's\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0where n,n1,n2,n3 is specified in number of IO's.\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0Without units:\r\n\r\n\u00a0 \u00a0 \u00a0 ELAPSEDSEC:\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Summary or Threshold is based on elapsed time\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0where n,n1,n2,n3 is specified as seconds.\r\n\r\nLIMIT - SUMMARY cannot be specified with THRESHOLD.\r\n\r\n\u00a0 \u00a0 \u00a0 - Options cannot be specified with SUMMARY.\r\n\r\n\u00a0 \u00a0 \u00a0 - If options are specified with THRESHOLD, the allowed options are\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 SQL, STEPINFO and OBJECTS.\r\n\r\nUSECOUNT - This option is exclusive to databases. No other logging or limit\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0options may be used on databases or in conjunction with the\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0USECOUNT option on databases.\r\n\r\nON - Account string information can be entered for ALL or for a single\r\n\r\n\u00a0 \u00a0 \u00a0user name. With a list of users, no account string can be specified.\r\n\r\n\u00a0 \u00a0 \u00a0With an application name or list, no user or account can be specified.<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Note:<\/strong> Be cautious as there may be performance impact on the teradata database when query logging is enabled for tactical \/ huge queries which are submitted per minute.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">begin query logging on all;\r\n\r\nbegin query logging with stepinfo, objects limit sqltext=1000 on username;\r\n\r\nbegin query logging with stepinfo, objects, explain, xmlplan, sql on all account = 'accountname'\r\n\r\nbegin query logging with verbose xmlplan on username;\r\n\r\nbegin query logging with usecount on databasename, databasename2, databasename3;\r\n\r\nbegin query logging with utilityinfo on username ;<\/pre>\n<p>&nbsp;<\/p>\n<p>To replace query logging i.e replacing an existing rule, use &#8220;REPLACE QUERY LOGGING&#8221;.<\/p>\n<p>The replace query logging syntax corresponds to the begin query logging syntax. If a replace query logging request specifies a rule that does not already exist, the request creates a new rule, similar to a begin query logging request else it replaces the current rule with rule you specify.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">replace query logging on all;\r\n\r\nreplace query logging with stepinfo, objects limit sqltext=1000 on username;\r\n\r\nreplace query logging with stepinfo, objects, explain, xmlplan, sql on all account = 'accountname';\r\n\r\nreplace query logging with verbose xmlplan on username;\r\n\r\nreplace query logging with usecount on databasename, databasename2, databasename3;<\/pre>\n<p>&nbsp;<\/p>\n<p>To flush one, several, or all database query log caches or Teradata workload management caches to disk, use &#8220;FLUSH QUERY LOGGING&#8221;.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">FLUSH QUERY LOGGING WITH flush-option [ ... ,flush-option ];<\/pre>\n<p>&nbsp;<\/p>\n<p>where:<\/p>\n<p>flush-option is<\/p>\n<pre class=\"lang:default decode:true\">ALL perform option ALLDBQL and ALLTDWM.\r\n\r\n\u00a0 \u00a0 \u00a0 ALLDBQL this is equivalent to DEFAULT,SQL,STEPINFO,OBJECTS,\r\n\r\n\u00a0 \u00a0 \u00a0 EXPLAIN,XMLPLAN,SUMMARY,LOCK,PARAMINFO.\r\n\r\n\u00a0 \u00a0 \u00a0 DEFAULT flushes DBC.dbqlogtbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 SQL flushes DBC.dbqlsqltbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 PARAMINFO flushes DBC.dbqlParamtbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 STEPINFO flushes DBC.dbqlsteptbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 OBJECTS flushes DBC.dbqlobjtbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 EXPLAIN flushes DBC.dbqlexplaintbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 XMLPLAN flushes DBC.dbqlxmltbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 LOCK flushes DBC.dbqlxmllocktbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 SUMMARY flushes DBC.dbqlsummarytbl table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 ALLTDWM this is equivalent to DEFAULT,SQL,TDWMHISTORY,TDWMEXCEPTION,TDWMEVENT\r\n\r\n\u00a0 \u00a0 \u00a0 TDWMHISTORY flushes DBC.tdwmeventhistory table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 TDWMEXCEPTION flushes DBC.tdwmexceptionlog table cache.\r\n\r\n\u00a0 \u00a0 \u00a0 TDWMEVENT flushes DBC.tdwmeventlog table cache.<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">flush query logging with all;\r\n\r\nflush query logging with objects;<\/pre>\n<p>&nbsp;<\/p>\n<p>To stop query logging, use &#8220;END QUERY LOGGING&#8221;.<\/p>\n<p><strong>Syntax:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">END QUERY LOGGING\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ ALL [ ACCOUNT = ('account id' [ ... ,'account id' ] ) ] }\r\n\r\nON\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ user-name [ ACCOUNT = ('account id' [ ... ,'account id' ] ) ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ user-name [ ... ,user-name] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ database-name [ ... ,database-name ] }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ APPLNAME = ('application-name' [ ... ,'application-name' ] ) }\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0{ ALL RULES } ;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">end query logging on all;\r\n\r\nend query logging on all rules;\r\n\r\nend query logging on username account = ('accountname');\r\n\r\nend query logging with utilityinfo on username;\r\n\r\nend query logging with verbose xmlplan on username;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Additional Information:<\/strong><\/p>\n<p>1. Grant the EXECUTE privilege on the special macro DBQLAccessMacro to enable\/disable query logging.<\/p>\n<p>2. Options for Flushing the DBQL Cache<\/p>\n<p>Before Teradata Database writes DBQL data to Data Dictionary tables, it holds the data in cache until either:<\/p>\n<p>\u2022 The cache is full.<\/p>\n<p>\u2022 You end query logging.<\/p>\n<p>\u2022 The number of seconds has elapsed that you define in the DBS Control utility field DBQLFlushRate.<\/p>\n<p>Note: You can select a rate from 1 to 3,600 seconds. However, Teradata recommends a flush rate of at least 10 minutes (600 seconds), which is the default. Less than 10 minutes can impact performance.<\/p>\n<p>\u2022 You flush the DBQL cache manually.<\/p>\n<p>3. Teradata Release 16.20 onwards :<\/p>\n<p>\u2022 The DBQL cache size is now adjustable from 64 KB to 16 MB, allowing to decide how much data the cache holds before\u00a0writing to the DBQL Data Dictionary tables.<\/p>\n<p>\u2022 The default DBQL table cache size increases from 64 KB to 2 MB.<\/p>\n<p>\u2022 The default block size increases from 64 KB to 1 MB. This value is not tunable.<\/p>\n<p>\u2022\u00a0 To adjust the DBQL cache size, change the value for the DBS Control parameter DBQLDefCacheSize\u00a0and restart Teradata Database.<\/p>\n<p>\u2022\u00a0FLUSH QUERY LOGGING request now supports the USECOUNT option.<\/p>\n<p>4.\u00a0DBC.DBQLRulesVX view does not exist by default and can be created using TSET with below steps:<\/p>\n<p>Start TSET<\/p>\n<p>goto to Tools-&gt;options<\/p>\n<p>Check on use X views (DBC and QCD) and press OK<\/p>\n\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2687\" class=\"pvc_stats all  \" data-element-id=\"2687\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Following query will verify if any DBQL rule exists: locking table DBC.DBQLRuleTbl for access select * from DBC.DBQLRuleTbl; &nbsp; Note: View DBC.DBQLRules OR DBC.DBQLRulesV can also be used in above query. &nbsp; To review existing DBQL rules you can either use &#8220;SHOW QUERY LOGGING&#8221; or Use DBC tables\/view mentioned earlier (e.g DBC.DBQLRuleTbl). Syntax: SHOW &hellip;<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2687\" class=\"pvc_stats all  \" data-element-id=\"2687\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/dbtut.com\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":197,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1307],"tags":[1479,1480],"class_list":["post-2687","post","type-post","status-publish","format-standard","","category-teradata","tag-dbql","tag-query-logging"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>DBQL rules - QUERY LOGGING - Database Tutorials<\/title>\n<meta name=\"description\" content=\"DBQL rules - QUERY LOGGING\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DBQL rules - QUERY LOGGING - Database Tutorials\" \/>\n<meta property=\"og:description\" content=\"DBQL rules - QUERY LOGGING\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\" \/>\n<meta property=\"og:site_name\" content=\"Database Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2018-09-10T07:00:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-06T08:46:11+00:00\" \/>\n<meta name=\"author\" content=\"Saumya Maurya\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Saumya Maurya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\"},\"author\":{\"name\":\"Saumya Maurya\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/90789f6afc5821060fae3a1c54a91eff\"},\"headline\":\"DBQL rules &#8211; QUERY LOGGING\",\"datePublished\":\"2018-09-10T07:00:37+00:00\",\"dateModified\":\"2018-12-06T08:46:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\"},\"wordCount\":511,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"keywords\":[\"DBQL\",\"query logging\"],\"articleSection\":[\"TERADATA\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\",\"url\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\",\"name\":\"DBQL rules - QUERY LOGGING - Database Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/dbtut.com\/#website\"},\"datePublished\":\"2018-09-10T07:00:37+00:00\",\"dateModified\":\"2018-12-06T08:46:11+00:00\",\"description\":\"DBQL rules - QUERY LOGGING\",\"breadcrumb\":{\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/dbtut.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"DBQL rules &#8211; QUERY LOGGING\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/dbtut.com\/#website\",\"url\":\"https:\/\/dbtut.com\/\",\"name\":\"Database Tutorials\",\"description\":\"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux\",\"publisher\":{\"@id\":\"https:\/\/dbtut.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/dbtut.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/dbtut.com\/#organization\",\"name\":\"dbtut\",\"url\":\"https:\/\/dbtut.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"contentUrl\":\"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg\",\"width\":223,\"height\":36,\"caption\":\"dbtut\"},\"image\":{\"@id\":\"https:\/\/dbtut.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/90789f6afc5821060fae3a1c54a91eff\",\"name\":\"Saumya Maurya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/dbtut.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0fd1deed7b06af46a8162f186b5b184ad2071aa70a090e47410ec483e50eb024?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0fd1deed7b06af46a8162f186b5b184ad2071aa70a090e47410ec483e50eb024?s=96&d=mm&r=g\",\"caption\":\"Saumya Maurya\"},\"url\":\"https:\/\/dbtut.com\/index.php\/author\/saumyamaurya\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DBQL rules - QUERY LOGGING - Database Tutorials","description":"DBQL rules - QUERY LOGGING","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/","og_locale":"en_US","og_type":"article","og_title":"DBQL rules - QUERY LOGGING - Database Tutorials","og_description":"DBQL rules - QUERY LOGGING","og_url":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/","og_site_name":"Database Tutorials","article_published_time":"2018-09-10T07:00:37+00:00","article_modified_time":"2018-12-06T08:46:11+00:00","author":"Saumya Maurya","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Saumya Maurya","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#article","isPartOf":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/"},"author":{"name":"Saumya Maurya","@id":"https:\/\/dbtut.com\/#\/schema\/person\/90789f6afc5821060fae3a1c54a91eff"},"headline":"DBQL rules &#8211; QUERY LOGGING","datePublished":"2018-09-10T07:00:37+00:00","dateModified":"2018-12-06T08:46:11+00:00","mainEntityOfPage":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/"},"wordCount":511,"commentCount":0,"publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"keywords":["DBQL","query logging"],"articleSection":["TERADATA"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/","url":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/","name":"DBQL rules - QUERY LOGGING - Database Tutorials","isPartOf":{"@id":"https:\/\/dbtut.com\/#website"},"datePublished":"2018-09-10T07:00:37+00:00","dateModified":"2018-12-06T08:46:11+00:00","description":"DBQL rules - QUERY LOGGING","breadcrumb":{"@id":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/dbtut.com\/index.php\/2018\/09\/10\/dbql-rules-query-logging\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dbtut.com\/"},{"@type":"ListItem","position":2,"name":"DBQL rules &#8211; QUERY LOGGING"}]},{"@type":"WebSite","@id":"https:\/\/dbtut.com\/#website","url":"https:\/\/dbtut.com\/","name":"Database Tutorials","description":"MSSQL, Oracle, PostgreSQL, MySQL, MariaDB, DB2, Sybase, Teradata, Big Data, NOSQL, MongoDB, Couchbase, Cassandra, Windows, Linux","publisher":{"@id":"https:\/\/dbtut.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dbtut.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/dbtut.com\/#organization","name":"dbtut","url":"https:\/\/dbtut.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/","url":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","contentUrl":"https:\/\/dbtut.com\/wp-content\/uploads\/2021\/02\/dbtutlogo.jpg","width":223,"height":36,"caption":"dbtut"},"image":{"@id":"https:\/\/dbtut.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/dbtut.com\/#\/schema\/person\/90789f6afc5821060fae3a1c54a91eff","name":"Saumya Maurya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dbtut.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0fd1deed7b06af46a8162f186b5b184ad2071aa70a090e47410ec483e50eb024?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0fd1deed7b06af46a8162f186b5b184ad2071aa70a090e47410ec483e50eb024?s=96&d=mm&r=g","caption":"Saumya Maurya"},"url":"https:\/\/dbtut.com\/index.php\/author\/saumyamaurya\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/2687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/users\/197"}],"replies":[{"embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/comments?post=2687"}],"version-history":[{"count":0,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/posts\/2687\/revisions"}],"wp:attachment":[{"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/media?parent=2687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/categories?post=2687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dbtut.com\/index.php\/wp-json\/wp\/v2\/tags?post=2687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}