Team,
Goal: find out which entities I have to manage so the Influx DB does not explode
Main: Maria DB
Long-term: Influx DB
For the Maria DB I can run a query and see exactly which entity generates ridiculous amounts of data.
Based on that I can fine-tune the configuration to exclude certain data.
HOW?
In PHPMyadmin select the HA database, click the states table, click the query tab and paste the following SQL, then click “GO”.
SELECT
COUNT(*) AS cnt,
entity_id
FROM states
GROUP BY entity_id
ORDER BY cnt DESC
This generates a list of all entities and the record count for that entity:
cnt entity_id
--- ---------
46951 sensor.memory_free
46091 sensor.processor_temperature
etc
How can I do this for the InfluxDB?
I can find:
-
the number of records for a specific measurement
(like m3, kWh, MB, etc)
SELECT COUNT(*) FROM "home_assistant"."autogen"."kWh"
-
the number of records for a specific entity
(like measurement: “kWh”, entity: “energy_consumption_tarif_1”)
SELECT COUNT(*) FROM "home_assistant"."autogen"."kWh" WHERE "entity_id"='energy_consumption_tarif_1'
IS IT POSSIBLE TO RUN 1 QUERY TO GET 2 COLUMNS: count AND entity_id?
This data also gives me an idea of which older (useless) records I may have to remove to make the DB smaller.