Oh, ok. If you’re going to write the aggregated data back to InfluxDB, you don’t need to pivot it. That should save you some compute time.
Yes, totally possible. There’s a thread about this here: Flux query over multiple downsampled buckets with different retention policies