Hi,
I user added a couple of alert rules that had 20,000 servers which were flapping for nearly 3 weeks. This has caused our annotation table to grow to 3 million rows, the database load is high due to the housekeeping, we’ve got batch size to 1000 but we’re hitting the timeout now and then, and obviously will take forever to clear.
Just wondering if it’s safe to truncate the table instead?
Yes, you can truncate the annotation table, but there is one important condition.
TRUNCATE will remove all historical annotation data from the table.
- It will not delete alert rules.
- It will not delete your servers.
- It will not delete your Grafana dashboards.
- However, all existing annotation history will be permanently removed.
Also, make sure the flapping alerts are fixed or disabled first. Otherwise, the alerts will continue generating new annotations:
Cheers @infofcc3 - great, that’s perfect
Just to update the thread with my steps.
- Scaled down the service to one node
- Stop grafana-server
- Connect to the database and executed the following:
- TRUNCATE TABLE annotation_tag;
- TRUNCATE TABLE annotation;
- Start grafana-server
- Scale service back to BAU