[Question] Merging multiple databases

Hey guys,

I’ve got a number of databases containing the same measurements (Think prod and dev) and along the way, data that was meant 1 db has ended up in the other, and so I need to merge them.

I was looking at continuous queries to do this, however I don’t want to downsample the data at all, I want to keep it raw.

Is this possible?

1 Like

You should be able to use SELECT INTO to copy data from one database to another. If you have multiple measurements to copy, you may want to use the measurement backref described in that section of the docs.

Depending on your data, you may need to also read up on how InfluxDB handles duplicate points.

1 Like

Hey Mark,

Thanks for that.
I gave the Select Into route a go, and it seems to have merged things nicely, however all of my tags have been converged into fields in the merged database, leaving no tags on any of the measurements…

Any advice?

Per “Common Issues with the INTO clause”:

To preserve tags in the current measurement as tags in the destination measurement, GROUP BY the relevant tag key or GROUP BY * in the INTO query.

When you have fields and tags with the same name, it makes querying difficult. You can disambiguate with ::tag or ::field suffix.

1 Like

I suggest use this tool , as a good and easy way to move/copy data across databases