Is it possible to "real time" query for recent events and roll up historical data by "Hour"?

For the most recently data, we need to query by the granularity “Second” or “Minite” as monitor,
and for the historical data, for example the latest month or the latest year, we need to query by

the “queryGranularity” of “Hour”.

Is it possible to build a Druid cluster to do this?

Appreciate for any answer or sugguestions.

while indexing, queryGranularity should be set to the smallest granularity that you would query. In your case, it seems, you should set queryGranularity to second. You would still be able to get data by granularity minute or hour etc. Druid will do further aggregation at query time.

– Himanshu

You can also periodically reIndex your data with hourly granularity once it is older than 1M, to achieve better rollup and reduce segment sizes for very old data.

found the cost of disk space can be acceptable, so finally I set the queryGranularity to “second”.

thank you for your help!