How to get the number users and groups in Confluence Server and Data Center

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 number of users and groups, and the depth of nested groups can contribute to performance and other stability problems in your instance. However, it can be difficult to find out the exact number of users and groups being synched from your LDAP directory, especially if you have nested groups.

Solution

If you experience problems, or you want to make sure you don't exceed our Confluence guardrails, you can use the following queries to check the total number users and groups.

These queries have been tested with PostgreSQL, Oracle 12c, MySQL 8.0, and Microsoft SQL Server 2017.

Get the total number of groups

Use this query to find out the total number of groups in the instance.

PostgreSQL, MySQL, Microsoft SQL Server, or Oracle

1 2 3 4 5 6 SELECT DISTINCT count(*) AS group_count FROM cwd_group WHERE directory_id in (SELECT id FROM cwd_directory WHERE directory_type in ('CROWD', 'AZURE_AD', 'CONNECTOR'))

Get the total number of users

Use this query to find out the total number of users in the instance.

PostgreSQL, MySQL, Microsoft SQL Server, or Oracle

1 2 3 4 5 SELECT DISTINCT count(lower_email_address) AS user_count FROM cwd_user WHERE directory_id in (SELECT id FROM cwd_directory WHERE directory_type in ('CROWD', 'AZURE_AD', 'CONNECTOR'))

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.