Queries returning different results

I’m trying to get information I gather from Unbound using Telegraf.

I have two sets of data presented on Grafana
The first shows the total queries within the last hour. At least it is it what I’m trying to achieve

select sum(*) as total_q from (select non_negative_difference(last(total_num_queries)) as total_num_queries from unbound where time > now() - 1h group by time(10s)) group by time(1h)

The two queries below compose a pie chart with cache miss and cache hit for the same period.

select sum(*) as tot from (select non_negative_difference(last(total_num_cachehits)) as total_num_hits from unbound where time > now() - 1h group by time(10s)) group by time(1h)

select sum(*) as totm from (select non_negative_difference(last(total_num_cachemiss)) as total_num_queries from unbound where time > now() - 1h group by time(10s)) group by time(1h)

If the influx database is clean within the first hour both total data (total query and missed+hits) matches. So, if I see 1000 queries, I’ll see 1000 splitted between missed and hitted, which is correct.

Funny enough, when I have more than an hour worth of data on the database, then if I see 1000 queries within an hour, the missed and hitted total doesn’t match the same 1000. I don’t know what is wrong.

I have similar queries for 24 hours and I see the same issue. The first 24 hours everything matches, with more than 24 hours worth of date they start to not match.

What am I doing wrong ?

Thanks