How to Get the Total Count of Projects Per Workflow in Jira via the Database
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Purpose of this article
The purpose of this article is to provide SQL queries meant to retrieve the number of projects using each workflow in the Jira application.
Environment
Jira Server/Data Center on any version from 8.0.0.
Solution
For MySQL
Run the following SQL query (note: This query is written in MySQL syntax. You will have to change the syntax to run on another DB)
1
2
3
4
5
6
7
8
9
select wse.workflow, count(p.pname) as `Total number of projects that use this workflow`
from nodeassociation n
inner join project p on p.ID = n.source_node_ID
inner join workflowscheme ws on ws.ID = n.SINK_NODE_ID
inner join workflowschemeentity wse on wse.scheme = ws.ID
where n.source_node_entity = 'Project' and n.sink_node_entity = 'WorkflowScheme'
group by wse.workflow
order by workflow;
For PostgreSQL
Run the following SQL query (note: This query is written in PostgreSQL syntax. You will have to change the syntax to run on another DB)
1
2
3
4
5
6
7
8
9
select wse.workflow, count(p.pname) as "Total number of projects that use this workflow"
from nodeassociation n
inner join project p on p.ID = n.source_node_ID
inner join workflowscheme ws on ws.ID = n.SINK_NODE_ID
inner join workflowschemeentity wse on wse.scheme = ws.ID
where n.source_node_entity = 'Project' and n.sink_node_entity = 'WorkflowScheme'
group by wse.workflow
order by workflow;
Was this helpful?