This query
select count(*) from complexWebsite where hoursSinceEpoch > cast(0.0 as long)
"timeUsedMs": 341,
"numEntriesScannedInFilter": 7500000
BROKER_REDUCE(limit:10)
COMBINE_AGGREGATE
AGGREGATE(aggregations:count(*))
TRANSFORM_PASSTHROUGH()
PROJECT()
DOC_ID_SET
FILTER_EXPRESSION(operator:RANGE,predicate:minus(hoursSinceEpoch,cast('0.0','long')) > '0')
is much slower than
select count(*) from complexWebsite where hoursSinceEpoch > 0
"timeUsedMs": 3,
"numEntriesScannedInFilter": 0
BROKER_REDUCE(limit:10)
COMBINE_AGGREGATE
FAST_FILTERED_COUNT
FILTER_MATCH_ENTIRE_SEGMENT(docs:7500000)
Because cast is not calculated at compile time. This results in the slow query not using metadata, because it doesn't know whether the function is volatile or constant.