In ClickHouse you could do this with a materialized view provided the specific_date_time_value is on some boundary like hour. If it's not you could union the results from a small fraction of the source data that does not fit the time slot you chose with the materialized view. I would also construct the ORDER BY in the source table to box the device data by hour or some other time increment.
Either way this would be extremely fast and would consume minimal memory. ClickHouse was designed for this kind of use case.