How to Get the Total Count of Projects Per Workflow in Jira via the Database

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

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)

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)

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;

Last modified on Nov 30, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.