Hi Carl,
It looks like you have a large category tree with a high number of categorized pages in a setup similar to the wiki page on OpenACS.org (and maybe the counting feature turned on).
Can you run the query with developer support turned on (db statistics activated) on a freshly started instance and send me the results?
A short time measure might be to increase the xowiki_cache size, which is per default just 400KB to e.g. 4MB (xowiki/admin -> parameters, requires a new start to used the increased the cache size). With a larger cache the first query will still be slow, but the overall user experience should improve.