Copy measurment to another DB with new measurment name

Hi @vinc

The task itself can be really easy but I need some additional info.

  1. You see you are running InfluxDB 1.8x, do you want to keep the same version?
  2. Do you want to move the data on a different DB in the same server or on some other server?

Now I’ll assume you are trying to move data locally, so just from a DB on the server to another DB on the same server.
You just need to use the INTO clause, in the docs you will find several useful examples, even to move lots of data.

The query you need is as simple as

SELECT * 
INTO "__DestDDB__"."__DestRp__"."__DestMeasurementName__" 
FROM "__CurrentDB__"."__RP__"."__Measurement__" 
GROUP BY *

Note that the GROUP BY * at the end is extremely important as it will keep tags and fields as they are, without it all the data will be stored as fields.
If you have a lot of data you might want to filter the data and load them a week at a time (or whatever suits you)

In order to make it work, you just need:

  • create the destination DB
  • create the desired retention policy

the measurement will be created automatically when the data are written