Hi @Sasikanth Prabha ,
Welcome to Microsoft Q&A platform and thanks for posting your query here.
As I understand your requirement, it seems you want to know if there is any workaround to find out the period of inactivity in dedicated sql pool so as to make sure that there is no active queries running and we are good to pause the sql pool.
This can be achieved by running monitoring queries in the SQL pool using script activity or stored procedure activity.
Use the following query in Script activity :
select count(*) as queriesRunning from sys.dm_pdw_exec_requests WHERE status='Running' and session_id <> session_id();
SELECT min(DATEDIFF (mi, end_compile_time, getutcdate())) as minutesPassed FROM sys.dm_pdw_exec_requests WHERE session_id <> session_id()
Use the below expression in If condition block:
@and(equals(activity('Script1').output.resultSets[0].rows[0].queriesRunning,0),greaterOrEquals(activity('Script1').output.resultSets[1].rows[0].minutesPassed,2))
Case 1: When query is running :
equals(activity('Script1').output.resultSets[0].rows[0].queriesRunning,0
will result in false
Case 2: When there is no active query but minutes passed is < 2:
Case 3: When there is no active query and minutes passed is >=2:
Hope this will help. Please let us know if any further queries.
------------------------------
- Please don't forget to click on or upvote button whenever the information provided helps you.
Original posters help the community find answers faster by identifying the correct answer. Here is how - Want a reminder to come back and check responses? Here is how to subscribe to a notification
- If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators