Continuous Query to straight copy from one retention to a different retention policy?

I’d like to create a continuous query that makes a straight copy of datapoints from one retention policy to another retention policy. The examples I’ve googled have used a SELECT mean(“value”) as well as a “group by time” as part of the the CQ. I don’t want that because the data I’m copying comes in sporadically, and I don’t want to average things.

Is something like this the correct way of doing it?

CREATE CONTINUOUS QUERY “status_cq” ON “main_database”
SELECT “value” AS value
INTO “infinite”.“status”
FROM “autogen”.“status”
group by topic

Thanks for any advice.

Afaik that’s not even possible, as CQs requires a group by time(), which will define the time interval/window considered by the query and also his frequency. (unless overridden with FOR and EVERY).

But requiring a group by time() also means that aggregation functions are mandatory, so you can’t just SELECT a field as a single point.

In the end, I don’t think what you ask is possible. CQs are meant for data downsampling not simple data transfer.

Note that manually doing SELECT ... INTO newRP FROM oldRP will work, but you can’t schedule that with as a CQ.

Possible workarounds (if you use Telegraf to input data or as a gateway)

If just some of your data have to be copied/cloned you can just use some filtering in the configuration


You could do this using a Kapacitor stream task i think. Kapacitor as a CQ engine

You can create a stream task and omit the group by time. The script would run in the background and process data as it arrived.

In the influxdbOut node specify your other database/retention policy

1 Like