Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/global.ini.php5
-rw-r--r--core/PluginsFunctions/Sql.php8
2 files changed, 12 insertions, 1 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index a85e72aa1f..f1e6f0b2fa 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -147,6 +147,11 @@ enable_browser_archiving_triggering = 1
; At the moment, this is not needed in core but it can be handy for plugins
enable_archive_parents_of_datatable = 0
+; 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
+
; MySQL minimum required version
; note: timezone support added in 4.1.3
minimum_mysql_version = 4.1
diff --git a/core/PluginsFunctions/Sql.php b/core/PluginsFunctions/Sql.php
index 88b4624c62..0ab94bdc31 100644
--- a/core/PluginsFunctions/Sql.php
+++ b/core/PluginsFunctions/Sql.php
@@ -150,6 +150,11 @@ class Piwik_Sql
*/
static public function optimizeTables( $tables )
{
+ $optimize = Piwik_Config::getInstance()->General->enable_sql_optimize_queries;
+ if(empty($optimize)) {
+ return;
+ }
+
if(empty($tables))
{
return false;
@@ -163,7 +168,8 @@ class Piwik_Sql
$nonInnoDbTables = array();
foreach (Piwik_FetchAll("SHOW TABLE STATUS") as $row)
{
- if (strtolower($row['Engine']) != 'innodb' && in_array($row['Name'], $tables))
+ if (strtolower($row['Engine']) != 'innodb'
+ && in_array($row['Name'], $tables))
{
$nonInnoDbTables[] = $row['Name'];
}