1

I have a InfluxDB that is limited to 40 GB, it's being filled by AppMetrics .NET integration performance metrics on each event in the code, usually hundreds of events per second. My problem is that this setup was running for a month and now has reached a state where it is at the limit and no new data/snapshots can be created. My question is there a way to process the DB in a way only 15 min aggregations are left for data older than 1 day?

1 Answer 1

1

Yes, influx provides continuous queries(CQ).

Continuous queries (CQ) are InfluxQL queries that run automatically and periodically on realtime data and store query results in a specified measurement.

Syntax

CREATE CONTINUOUS QUERY <cq_name> ON <database_name>
BEGIN
  <cq_query>
END

where cq_query is

SELECT <function[s]> INTO <destination_measurement> FROM <measurement> [WHERE <stuff>] GROUP BY time(<interval>)[,<tag_key[s]>]

Example:

CREATE CONTINUOUS QUERY "cq_basic" ON "transportation"
BEGIN
  SELECT mean("passengers") INTO "average_passengers" FROM "bus_data" GROUP BY time(1h)
END

P.S One thing needs to be noted here is that, the fields created into the new measurement are prefixed with the function name. In above case, mean_passengers would be inserted as column name. To overcome this you can use 'AS'.

Refer this link for detailed https://docs.influxdata.com/influxdb/v1.7/query_language/continuous_queries/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.