How to find the number of deployment projects and environments from Bamboo 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
The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.
You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.
We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!
This article will explain how to get the total number of deployment projects and deployment environments in Bamboo by querying the Bamboo database. This can be helpful to understand the size in case if there is any slowness related to deployment projects or environments.
Environment
The solution was tested on Bamboo 9.6.5, but it will be applicable to other supported versions as well.
Tested on Postgres and MSSQL Database.
Solution
Below SQL queries can be run on Bamboo database to get the counts.
Total number of deployment projects
1
select 'Total deployment project count' as COUNT_NAME, count(*) from DEPLOYMENT_PROJECT;
Sample Output
1
2
3
4
count_name | count
--------------------------------+-------
Total deployment project count | 1198
(1 row)
Total number of deployment environments
1
select 'Total deployment environments count' as COUNT_NAME, count(*) from DEPLOYMENT_ENVIRONMENT;
Sample Output
1
2
3
4
count_name | count
-------------------------------------+-------
Total deployment environments count | 80050
(1 row)
Count of Deployment Environment per Deployment Project
1
2
3
4
5
6
7
SELECT dp.NAME AS DEPLOYMENT_PROJECT_NAME,
Count(*)
FROM DEPLOYMENT_ENVIRONMENT de
INNER JOIN DEPLOYMENT_PROJECT dp
ON de.PACKAGE_DEFINITION_ID = dp.DEPLOYMENT_PROJECT_ID
GROUP BY dp.NAME
ORDER BY Count(*) DESC;
Sample Output
1
2
3
4
5
6
7
8
9
10
11
12
13
deployment_project_name | count
-------------------------+-------
Deployment project 0 | 4000
Deployment project 1 | 4000
A Deployment project 10 | 500
A Deployment project 12 | 500
A Deployment project 13 | 500
A Deployment project 14 | 500
A Deployment project 16 | 500
A Deployment project 15 | 500
A Deployment project 17 | 500
A Deployment project 11 | 500
(10 rows)
Was this helpful?