How to find pages with the most child pages

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

Some actions, such as moving a page, can take a long time when the page has a very large number of child pages. For this reason it can be useful to identify pages with a very large number of children and, if necessary, break up the page hierarchy into smaller page trees.

Solution

The following query will return details of the 50 pages with the most direct child pages.

1 2 3 4 5 select contentid, title, count from content join (select parentid, count(*) from content where contenttype = 'PAGE' and content_status = 'current' group by parentid order by count desc limit 50) top on top.parentid = content.contentid;

This query has been tested with PostgreSQL, and may need to be adapted for your database.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.