You are viewing limited content. For full access, please sign in.

Question

Question

SQL Query to identify workflows running more than an Hour.

asked on February 22, 2018 Show version history

Hello Everybody,

 

I'm trying to create a SQL query to identify runaway or slow workflow (more than a hour running), until now I only saw this here on answers.

select count(a.task_id)
	, a.instance_id
	, a.activity_name
	, b.workflow_id
from workflow_task_queue_data a inner join search_instance b
  on a.instance_id = b.instance_id
  group by a.instance_id, a.activity_name,b.workflow_id

I don't know much about how the table structure is in workflow database, the only thing I need is

 

Workflow Status

Start Time

Workflow Name

 

if someone could point me where those values are I can create the sql query.

 

 

Thanks.

Amir

0 0

Replies

replied on February 22, 2018 Show version history

I'm using this query now

 

SELECT IWN.[workflow_id],IWN.[workflow_name], SS.[start_time], SI.[instance_id], SI.[workflow_rule], SI.[workflow_user]
  FROM [search_status] SS
  INNER JOIN [search_instance] SI ON SS.[search_id] = SI.[search_id]
  INNER JOIN [index_workflow_name] IWN ON SI.[workflow_id] = IWN.[workflow_id]
  WHERE [start_time] >=	DATEADD(HOUR, -1, GETUTCDATE())
  ORDER BY [start_time] DESC

 

@████████ can you please confirm if this query will work as expected?

0 0
replied on February 27, 2018

No, it will not.

0 0
replied on February 27, 2018

What is the actual problem you're trying to solve? Runaway workflows wouldn't necessarily run for more than one hour. And workflows waiting for user actions could legitimately take more than one hour (although they wouldn't be actively running for that long).

0 0
replied on February 27, 2018

Hello Miruna,

 

Yes the idea is identify any workflow that takes more than one Hour to complete. this include runaways workflows and workflows delayed by user interaction. 

This needs to be in a SQL Query since the client wants have this as an automatic notification, so they don't have to open workflow designer to verify any active workflow.

0 0
replied on June 16, 2022

Did you ever figure out your query?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.