One of my colleagues just did a test on XWiki 10.5 with Postgres 10:
- 4k pages under a top level page “Test”
- 5 nesting levels under the “Test” top level page
- the mean time over 25 requests to expand the tree is 65ms
This is on his laptop which has SSD storage and i7 CPU.
Based on this I think there is a problem with the pages you imported. Can you try the following script in a separate page:
#set ($start = $datetool.date)
$services.tree.nestedPages.getChildren('document:xwiki:Administracja.WebHome', 0, 15)
#set ($end = $datetool.date)
#set ($delta = $end.time - $start.time)
This will give you the time in ms to fetch the children of the Administracja page without doing any rendering. It should be very fast. On my colleague’s laptop we get 4ms for the “Test” top level page (that has 4k nested child pages).
If it’s fast for you too then it means the problem is not at the database level but at the rendering level. And on the rendering side the problem could be the title of the imported pages. In order to display the pages in the tree we need to render their title. If the title contains scripting (Velocity) then this can slow down the tree.