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 count pages in a whole Confluence instance?


who can help - I'd like to know how many pages are on my Confluence? The total number mustn't include deleted articles (from the recycle bin).

2 answers

The best way to get an accurate count of the number of pages in the instance (excluding their previous versions) is to run this query against your database:

select count(*) from content where contenttype='PAGE' and prevver is null and content_status='current';

Limiting the contenttype to PAGE removes space and global descriptions, user info, drafts, and blog posts; only returning rows with a null previous version ensures that only the current version of the page is counted; lastly, content that has been deleted will have a status of "deleted," so you only want the rows that are still in the "current" status.

If I use the {sql} macro, is it dangerous in terms of security? Is it true that any user can run the macro and get any data?

Penny Wyatt Atlassian Team Jul 28, 2011

Yes, the {sql} macro opens up your whole database to any user who can edit Confluence content.

2 votes

For Confluence Cloud users, consider using REST API as below because Confluence Cloud doesn't support SQL, Macro, and some Add-ons for stats.

# Total number of pages
curl -sGLu ${A_USER}:${A_PASSWD} "https://${INSTANCE_HOST}/wiki/rest/api/search" --data-urlencode 'cql=type IN (blogpost, page)' --data-urlencode 'limit=0'


Refer my related answer at For Confluence Cloud, how do I find the total number of pages? for more detail if you needed.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 (you can also ...

2,515 views 14 20
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you