matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.93k stars 2.66k forks source link

Move Annotations into their own dedicated table #19306

Open samjf opened 2 years ago

samjf commented 2 years ago

Move Annotations into their own table

At the moment annotations are saved in the Option table into a single row per site (see \Piwik\Plugins\Annotations\AnnotationList::save). This approach seems to cause DB performance problems when annotations are added in bulk due to constant serialization and locks for updating on a single row.

An approach to cleanly solve this problem would be to create a dedicated DB table for the annotations rather than the single row serialization. This would require a new model/schema and a migration of the current data, but would be a good way to future proof and solve this performance problem.

Your Environment

justinvelluppillai commented 2 years ago

I will move this to the For Prioritization queue. It is a pretty important issue to keep Cloud performant also.

Chardonneaur commented 2 years ago

Would it be possible to add it as a report in itself too? So that we could export it afterwards? For example as an email report.

sgiehl commented 2 years ago

@Chardonneaur In theory the would be possible. For that we need API methods to fetch those annotations and a report class to provide that. But not sure if that will be handled in this issue.