Database & Recorder integration: Overhaul UI to permit reduced DB size and ease of entity exclusion from statistical tables #2899
Unanswered
twcau
asked this question in
Core functionality
Replies: 3 comments 1 reply
0 replies
|
Very nice work! Well thought-out. It would be great to see Recorder get some developer love. I've made a few similar suggestions over on the community forum. Specifically, I think the changes below would avoid the frustration you (and many other users) felt when they discovered that the default Recorder values set them up for failure.
|
1 reply
|
Architecture discussion got approved: home-assistant/architecture#1106 The ability to easily see and edit which entities are stored and how long would be awesome. Now I often forget to add things to yaml. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Describe your core improvement
Prompt at instance setup to configure settings for proper DB maintenance from the outset: As part of the onboarding/instance first time setup process, or at a later stage by way of repair, give the user an informed prompt (inc. links to relevant resources) to help the user set the following information for
recorder::auto_purge: <true or false>purge_keep_days: <numerical value>commit_interval: <numerical value>Offer a UI panel for ongoing maintenance of
recorder:configuration: Allow the user to easily update all parameters ofrecorder:from the UI, including:domains:andentity_globs:forinclude:andexclude:,Enhance UI when adding integrations and devices to support proper DB maintenance: Allow users to easily manage if an integration/device/entity is included or excluded from statistical databased by way of adding functionality to the UI, that will allow the user to exclude an integration/device/entity from both the
statistics_short_termandstatisticstables.Places for this to be added would include, but not necessarily limited to:
Apps and Integrations allowed to signal defaults during setup: Allow both Apps and HACS plugins, to provide methods in their packages to signal to HA if an integration/device/entity/attribute should be excluded (as a default) from any statistical databases; whilst ensuring the user has the ability to override in UI if they choose.
Update /config/storage to explicitly separate out the size of the HA database: This is self explainatory.
Make filesize integration part of core: Bring the existing Filesize integration - or something like it - in HA Core, and ensure the DB size metric is a standard entity available on all instances (and whilst setting defaults to exclude this from long-term storage, as this is - for the most part - an ephemeral statistic).
Make DBStats HACS integration part of core: Bring the existing DBStats HACS integration - or something like it - into core, so users can easily visualise and understand what parts of the database are taking up space, and more importantly which entries account for it.
Make possible and easier for moving of older short and long term statistics, already in the db, into other database platforms: It should not rely on the user to figure thus out on their own to export such statistics into more efficient time series database options like InfluxDB.
Current limitations
HA not designed to store only what is needed from the beginning: At present, Home Assistant does not ensure appropriate database efficiencies from the beginning.
Users won't identify the problem or impacts until it's too late: Users can end up with databases that are bloated, contain unnecessary or ephemeral metrics, that are of zero value to long-term analysis.
Impacts to, and performance hits, from unnecessary read/write operations to flash memory and/or single-board computers: I suspect that the Basic analytics HA gets would support this, but I'm willing to wager that a significant number of HA instances are running on the types of devices and/or types of storage hardware (Flash storage inc. memory cards and SSD's) whose service life and capabilities are impacted from unnecessary read/write IO operations. If HA can be designed for efficiency from the outset, this improves instance performance, device and storage lives, creating better user outcomes.
Level of learning needed to address: To manage this, users have to spend a lot of time on the following activities:
recorder:inconfiguration.yamlto either include, or exclude items from going into statistics in the first place; andrecorder.purgedoes not clean up (covered more at Point 6).Prevalence of integrations storing ephemeral data: These issues are especially prevalent when users have integrations and entities that cover areas such as:
This is generally going to be data the user doesn't need to keep beyond a limited window; but to know they should exclude it, or for integration authors to have the ability to easily signal and ensure its excluded, just isn't offered in HA - it's all reliant on the user spending a lot of time figuring it out.
Cleaning up existing data you don't need is difficult: Even after updating
recorder:and runningrecorder.purge, there's always still a lot of stuff in the DB that doesn't need to be there (ask me how I know, as I've been living this for the last week).So the user will once again need to go off and learn queries in SQLite, along with installing another app, so you can really get your hands dirty and clear out the junk - hoping you don't accidentally break something because you don't have backups, or didn't run a dry-run query first, or failed to properly understand the database schema and got rid of things you actually wanted and/or needed to keep.
Technical benefits
Improve the friendliness and efficiency of HA from day one, especially for non-technical users, by:
Additional context
All reactions