Piwik SQL optimization issue


We are using Piwik1.6 version and we want to disable the OPTIMIZE TABLE query on the db tables.

Its mentioned in few forums/faqs that,
optimizeTables() method Runs an OPTIMIZE TABLE query on the supplied table or tables.And the property ‘enable_sql_optimize_queries’ can be used set the option to optimize or not.

But i am not able to find these two in our Piwik source code.

Can you please help us to solve this

Thanks in advance


1- optimize_tables()

2- enable_sql_optimize_queries

; By default Piwik runs OPTIMIZE TABLE SQL queries to free spaces after deleting some data.
; If your Piwik tracks millions of pages, the OPTIMIZE TABLE queries might run for hours (seen in “SHOW FULL PROCESSLIST \g”)
; so you can disable these special queries here:
enable_sql_optimize_queries = 1


Hi JM,

Thanks for quick reply.:slight_smile:

Currently we are using Piwik VERSION = ‘1.6’;

And i am not able to find this optimize_tables() method and the property 'enable_sql_optimize_queries ’ in our Piwik installation code base.

It seems both of these are not available in Piwik VERSION = ‘1.6’ source code.

Can you please let me know
if i can still exclusively set the property enable_sql_optimize_queries to 0 to disable Optimization process.
OR different mechanism is used in the older versions of Piwik to disable Optimization process.

Can you please suggest some clues.

Thanks again

Hi there,

please try upgrade to latest 2.15.0 beta version which includes many fixes and improvements, see: I would like to test early beta and RC releases, how do I enable automatic updates to use these development versions? - Analytics Platform - Matomo

If you still have a problem, please create an issue on our tracker GitHub - matomo-org/piwik: Liberating Web Analytics. Star us on Github? +1. Matomo is the leading open alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites, apps & the IoT and visualise this data and extract insights. Privacy is built-in. We love Pull Requests!