The list of prefixes comes from the cache (prefixCache), so no query.
If the number of threads per prefix is already cached, there is only the query to get the cache from the data registry table.
If the cache is not present, there is a query to set the cache and for each prefix a query to count the threads in that prefix.
And the queries are per forum, not thread.