Hello,
Is it possible to delete data from the “insights_raw” table to reduce the database size? Insights are already turned off, so there won’t be any need for it at the moment, but the insights table accounts for 92% of the total database size.
Thank you.
before you proceed I’d strongly recommend Take a full database backup first
since you already turned insights off, n8n isn’t using that data for anything anyway. it just powers the built-in usage dashboards. dropping those rows won’t break your workflows.
there’s a catch with sqlite though. if you just run DELETE FROM insights_raw;, the actual database file size on your disk won’t change. sqlite just marks the space as empty inside the file for later.
to actually shrink the database and get your storage back, you have to run VACUUM; right after your delete command.
just make sure you stop your n8n docker container first before opening the sqlite file and running those commands stops database locking issues.
We also have the insights dashboard off as well, so we can just remove the data then. Regarding the need for size reduction, there’s an environment variable we found which shrinks the database on restarts, so that’s covered as well.