Hi Eliot,
It’s difficult to give a general response on that without having a complete look at the architecture, but I’ll try:
I’m measuring a consistent 0.3 seconds for this query:
How much time is spent if you omit the parent step?
db:token($analyticsmgmt:analyticsDatabase, $docPath, 'topicpath')
Next, how much results do you get for a single request? Is it always a single result, or can it be a vast number? How are the values distributued (index:tokens may help to assess this)?
You can attach "=> prof:time()" to an expression to do some isolated performance measurements.
In principle, it makes no difference if the data is stored in one huge document or in millions of documents.
Best, Christian