How to query the database for issue type statistics per project in Jira Datacenter or Server

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

The SQL queries in this article are only provided on best-effort basis and are not supported by Atlassian.

Admins may want to pull statistics of how many issue types there are per project in Jira.

Solution

Run the SQL query:

⚠️ This query was written for Postgres and may have to be updated to work on another database:

1 2 3 4 SELECT p.pkey, it.pname, COUNT(i.id) FROM jiraissue i INNER JOIN project p ON i.project = p.id INNER JOIN issuetype it ON it.id = i.issuetype GROUP BY (p.id, it.id) ORDER BY p.pkey, count DESC;

Here's a sample output of the results from a test system:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 pkey | pname | count ------------+-----------------+------- ITSRVDSK | Service Request | 35 ITSRVDSK | Incident | 4 ITSRVDSK | Task | 3 ITSRVDSK | Change | 2 ITSRVDSK | Problem | 1 PMGMT | Task | 6 SCRUMMY | Story | 36 SCRUMMY | Sub-task | 10 SCRUMMY | Bug | 4 SCRUMMY | Epic | 2 SCRUMMY | Task | 1 SCRUMMY | Initiative | 1 SCRUMMYTWO | Story | 16 SCRUMMYTWO | Bug | 4 SCRUMMYTWO | Sub-task | 3 SD | Service Request | 32 SD | Incident | 5 SD | Change | 2 SD | Problem | 1 (19 rows)
Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.