- Create space with at least 30000 pages. Problem will be easier to observe with more pages
- Add a page with the index macro
Page renders quickly with the macro indicating that page index cannot be displayed due to space containing more than 5000 pages
The page takes a long time to render. It will eventually show the expected message above, OR it will show a 120 second macro timeout given enough pages (which occurred at ~130k pages in my testing).
Through SQL logging we can see that Confluence does indeed issue a query to count pages in the space, and the results are correctly received. The below is pulled from a test Confluence 6.6.2 instance where the space has 129077 pages.
However, it continues to fetch all the pages anyway in the next query: