@mattab opened this Issue on April 21st 2015 Member

The goal of this issue is to consider if it's possible to simplify a key component of Piwik core architecture: database drivers.

Current Piwik uses two different implementation of Database objects, Tracker\Db (used in Tracking API) and Db (used everywhere else). It's always a bit surprising when one learns about this. The historical reason was that Tracking API needed to be small memory footprint and very fast, which is still the case today, but back in the day it was estimated that loading Zend_Db was too slow. But maybe today is not anymore so important and maybe we could merge and use only one Db driver for easier maintenance & more clean code platform in the future?

(to find out we may want to compare profiles of Tracker\Db vs Db and see if there's any difference at all already, or if not too difficult to do maybe we could directly make the switch in the codebase and compare performance of before/after)

@mattab commented on July 14th 2015 Member

Tentatively adding to 3.0.0 roadmap. Is this actually do-able in 3.0.0, what do you think?

@mnapoli commented on July 20th 2015 Contributor


@tsteur commented on May 10th 2022 Member

If we implement this as part of Matomo 5, then ideally there weren't any breaking changes as this could make it quite hard for people (and ourselves) to make plugins compatible and to figure what changes are needed.

If there has to be a breaking change, then this should be only in the tracker DB as less plugins are using the tracker DB meaning it will be less work to make plugins compatible and we get less unexpected bugs.

@sgiehl commented on May 10th 2022 Member

If we decide to do that in Matomo 5 I would suggest to get rid of Zend_Db completely. It already isn't able to handle MySQLi exceptions that are thrown on PHP8.1 by default. So might be better to replace it with some custom adapter or maybe another library that isn't too overblown.

@tsteur commented on May 10th 2022 Member

If we can fix the issue for PHP 8.1 ourselves in Zend (maybe we already did), I would highly recommend not doing it as it might be hard to keep the DB adapter compatible with a newer library and the effort does in the end not outweigh the benefits if otherwise everything works. It be quite a bit of effort to keep the same API, not change any behaviour, etc. As we wouldn't want plugins needing any change for no real benefit in the end.

Powered by GitHub Issue Mirror