Hello,
I am trying to backfill a retention policy by downsampling my data by taking the mean. I am doing so with a query that looks like this:
SELECT mean(*) INTO "telegraf"."month".:MEASUREMENT FROM /.*/ WHERE time > now() - 30d GROUP BY time(10m),*
Unfortunately, this has the effect of re-naming all my field keys. e.g. “cpu”.“usage_idle” becomes “cpu”.“mean_usage_idle”.
Is it possible to do this while retaining the original names? I know I could create a separate statement per field and use AS, but that would be very cumbersome.
Why do you want to keep the name the same? I don’t know if that’s possible, but I’ll look into it. For me personally, I like to keep my downsampled data as a different series because I tend to treat it and interact with it differently than my high precision data.
@AnaisdgI would like to be able to use my Graphana graphs with both the real and downsampled data, but I am unaware of how to do this if they are named differently.
@Anaisdg Thank you. Yes I can do that, but it complicates things. For example I might have a graph of network traffic for a dozen interfaces and that would require creating duplicates for each retention policy.
However, believe I have stumbled on a decent solution. I can just query for the series using a regex. E.g. SELECT /^(mean_)?cpu_usage$/ rather than SELECT “cpu_usage”.