Finding freq of a qry

Database
Enthusiast

Finding freq of a qry

Hi all!

Thsi sounds simple but I wanted to know if there is any way to find the frequency of a query. Whether it runs daily/weekly etc?
I can get most of the info from DBQL like username , database , the SL text but not the freq.
Any pointers will be helpful.

Thanks!
3 REPLIES
Enthusiast

Re: Finding freq of a qry

dbql also has a column named collecttimestamp, this column along with some sql magic should get you what you want...
Enthusiast

Re: Finding freq of a qry

Yes I know about the ollecttimestamp, but what would be the SQL magic? The DBQL doesnot have the actual query so that I can compare the sQL text.
Enthusiast

Re: Finding freq of a qry

What are the DBQL rules active for the account that runs the query? Depending on your settings, the SQL should be stored either in DBQLogTbl.QueryText or DBQLSqlTbl.SQLTextInfo.

So something like: SELECT SQLTextInfo, COUNT(*) FROM DBC.DBQLSqlTbl GROUP BY 1;

You could add joins to DBQLogTbl to get other filters (user, etc.) as well as a time range/block if you're looking for some kind of arrival rate or similar metric.

If you truly can't get the SQL from either place, you may be out of look. Do you use query banding at all? This could be used to identify a query and count a frequency from there.