I agree it is a complex subject, specially when considering scalability issues.

For my medium-sized wiki I think I will settle for a cache expiration of half an hour. This should keep load at an acceptable level and provide information that in acceptably up-to-date.

Even though the heavy-duty query optimization mechanism would be great, I think that in its absence a simpler solution would still be better: the option to not to cache pages with inline queries.

If only a few pages on a wiki use inline queries, almost all of them would use the default cache, and the dynamic ones wouldn't use cache.

It would be the administrator's decision to enable this feature and favor correctness over performance for this kind of page.

I think that could be done with a trick on the parsing of the ASK tag, described in a previous message.