Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get confluence licensed users count from database

I am new to confluence. I just would like know how to get confluence licensed users count. Currently, our organisation has limit of 10000  users. And in this 4935 signed up users. I mean 4935 used. But when trying get count for licensed users from data base using following query I got only 2932. I am not understanding why both displaying different. Please let me whether I am using correct query or not getting licensed users count for confluence.


SELECT count(
cwd_user users
cwd_directory userdir
users.lower_user_name IN
OR users.lower_user_name IN
cwd_user u
cwd_directory d
u.directory_id =
cwd_membership m
ON = m.child_user_id
cwd_group g
ON = parent_id
g.lower_group_name =lower(sp.permgroupname)
permtype='USECONFLUENCE' )

2 answers

1 vote

Don't bother with the database, it's complex and you're looking at the wrong thing anyway.

Go to Admin -> Global permissions and get the list of groups that have "can use" in there.  The members of those groups are the ones that give you  the 4953 (note, that deduplicates users - if you're in three of the groups for example, you only count once to the 4953)

Thank you for response. But, I have different situation like I need to read the list of licensed users from data base.  So, I google it and tried with multiple queries but mostly the results are getting below 3000. But, when I verify the count in Confluence Admin page it has 4900+ used licenses.


May be you are right, one user can have multiple licenses. because of that count is varying. But, I need total licenses used count using script. I don't have knowledge how to get that.

"I need to read from the database" does not explain what you are trying to do.  It is almost certainly the wrong way to do it.

Instead of running off down the path of a probably complex and inaccurate solution, could you explain what you are trying to achieve instead?

Your original question was "I want to get the number of licenced users" and you then said you had 4935.  Assuming that is from the Confluence system information, licence or user list pages, then it is already the answer.  Why are you trying to replicate it using another method?

I am trying to create a console job to get the count of licensed users and need to notify the admins if count crossed certain limit. For that, I am trying to fetch the signed up users count and verifying count is crossed or not in console. But, my problem is I am unable fetch actual count  that displayed in the admin page. Please let me know if you have other ways to read the count if it is not possible from database.

I am still not understanding why reading from database is not right way.

The database is not right because you are asking it the wrong question.  Because it's messy and can't tell you the right answer unless you completely understand it.

Best way to do this would be to note what group(s) let you into Confluence (they rarely change once set up) and then get the list of users in those groups over the REST API 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Security Advisory for Jira Service Management

On October 20, 2021, Atlassian published a security advisory for Jira Service Management. The full advisory is available at this link.  We've seen a number of questions already asking for...

61 views 0 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you