High memory consumption with continuous query

I execute the continuous query with lots of series and datapoints.

I got the logs and here are.
finished continuous query cq_test_30_minutes, 124,029 points(s) written (2017-07-17 15:00:00 +0800 HKT to 2017-07-17 15:30:00 +0800 HKT) in 6m41.109473018s service=continuous_querier
-> the memory increased to 96.7%. (the memory is 32GB) and the number of result series is 680,464.

finished continuous query cq_test_30_minutes, 67481 points(s) written (2017-07-17 16:00:00 +0800 HKT to 2017-07-17 16:30:00 +0800 HKT) in 7m10.559523016s service=continuous_querier
-> the memory increased to 97% and the number of result series was from 886,062 to 941,291.

I want to decrease memory usage. could you help me please?

My continuous query is
CREATE CONTINUOUS QUERY cq_test_10_minutes ON table BEGIN SELECT sum(count) AS count, median(latency) AS medain_latency, max(latency) AS max_latency, min(latency) AS min_latency, mean(up_bytes), mean(down_bytes) INTO tb_network_10_minutes FROM tb_network GROUP BY time(10m), app_seq, version, carrier, city, device_os_version, device_model, domain, path, result_code END

should I group the data with lower tags?

@soo That is one way to reduce memory usage. You could also reduce the GROUP BY time() so that the query pulls up less data with each run.