Before a Database upgrade on a high traffic Piwik server, it is highly recommended to:

  • disable Piwik Tracking: in the config/config.ini.php, add the following
[Tracker]
record_statistics = 0

This will cause all Piwik Tracking requests to return quickly the 1*1 gif beacon, without connecting to the Database or doing any processing.

  • disable the Piwik User Interface: you can also disable the User Interface, which will display a maintenance message instead of the standard Piwik UI. If you run the Piwik Database Upgrade script using the shell/console command, we highly recommend to turn Piwik off while the upgrade is in process. Disabling the Piwik User Interface will prevent other users from accessing Piwik while the Database upgrade is in process.
    To do so, add the following in the config file:
[General]
maintenance_mode = 1

When maintenance_mode is on, the API is also disabled. For example, the XML message returned is:

<result><error message="Piwik is in scheduled maintenance. Please come back later. "/></result>

When the Piwik update is finished, do not forget to re-enable Visit Tracking and/or the User Interface.