useCache at query time


I decided to use the context option “context”:{“useCache”:“false”} at query time to see my performances with no caching (which is important for us) and i was surprised that it works like this.

I was expecting be override by cluster configuration or disable cluster configuration, but there is a thing i probably miss.

In fact, when i do a groupBy, the option work perfectly and it’s very cool for us, but when i do a TopN, it’s not working anymore …

There is something i missed about how to use / understand it ?



Hey Ben,

What exactly is not working?

Btw, if you want to completely disable all the caching related things, set “populateCache”: false too. Otherwise queries will still be writing data into the cache, even when they’re not reading from it.

Hey Gian,

Thanks for your reply !

I use it already like this “context”:{“useCache”:“false”, “populateCache”:“false”}

The fact is, when i do a groupBy in the first run and got for example 1000ms, when i run again i got the same response time: 1000ms.

But when i do a TopN, i got 2000ms in the first run and 700ms in the other following.

I think this option just don’t work with TopN.

Or maybe it’s not working when the cache is enable is node configuration files, and in this case it should not work with groupBy.



By default, groupBy doesn’t use the cache at all; see druid.historical.cache.unCacheable on The rationale is groupBy result sets can be quite large and might not make efficient use of the query cache. topN does use the cache by default. It should respect those options when they are “false” though. useCache/populateCache cannot enable caching if it has been disabled at the server level, but they can disable caching for a specific query.

Do you notice any difference when useCache/populateCache are true vs false?

It’s possible that the topN sped up not due to the Druid query cache, but just due to the OS page cache (the data getting loaded into memory from disk).

And, indeed, it works well on topN, it is due to something else, maybe OS page cache ! :wink:

I think this issue is resolved, even if it wasn’t one !

Thanks again !

I removed GroupBy from druid.historical.cache.unCacheable, but i didn’t mentionned it, sorry !