Title: Excessive Database Queries and Export Functionality Failure
Last modified: January 27, 2025

---

# Excessive Database Queries and Export Functionality Failure

 *  Resolved [malimart](https://wordpress.org/support/users/malimart/)
 * (@malimart)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/)
 * I am experiencing issues with the plugin in a WordPress multisite environment.
   Below are the details of the problem.
 * **1. Excessive Database Queries**
 * Every time the plugin was **network activated**, it flooded the MySQL database
   server with the same query, which it repeatedly sent non-stop, even if no migration
   was in progress. Query Example:
 *     ```wp-block-code
       UPDATE wp_sitemeta SET meta_value = 'a:12:{s:21:\"id_slug_type_path_map\";a:2:{i:10340;a:3:{s:4:\"slug\";s:10:\"tablepress\";s:4:\"type\";s:6:\"plugin\";s:4:\"path\";s:25:\"tablepress/tablepress.php\";}i:3826;a:3:{s:4:\"slug\";s:11:\"prime-mover\";s:4:\"type\";s:6:\"plugin\";s:4:\"path\";s:27:\"prime-mover/prime-mover.php\";}}s:11:\"plugin_data\"; ...
       ```
   
 * The query is extremely long (90,000 characters) and identical each time. This
   behavior continued as long as the plugin was active, causing a significant negative
   impact on the MySQL database server.
 * **Attempted Solution**
 * To resolve the issue, I updated the plugin from version 1.9.9 to 2.0.3, but unfortunately,
   the problem persists. As soon as I network activate the plugin, the same query
   is sent repeatedly to the database. Due to this issue, I only activate the plugin
   when it is needed, as the constant database activity degrades server performance.
 * **2. Export Functionality Broken in Version 2.0.3**
 * After upgrading to version **2.0.3**, the export functionality no longer works.
   When attempting to export, the progress stays at 0% in the network admin dashboard.
   The following two log entries repeat endlessly during the alleged migration process:
 *     ```wp-block-code
       2025-01-27 16:33:07 => Logged export event for blog ID 57873 from Codexonics\PrimeMoverFramework\classes\PrimeMoverValidationHandlers::validateInputParameters method: common_progress_processor: Validation success
       2025-01-27 16:33:07 => Logged common event for blog ID 57873 from Codexonics\PrimeMoverFramework\utilities\PrimeMoverComponentAuxiliary::restoreExcludedOptions method: DB LOCK: Not being able to move setting prime_mover_excluded_settings_db_57873 from user meta to options in prime_mover_shutdown_actions hook using user ID: 91722 because the value is not an array or empty.
       ```
   
 * These repeating log entries suggest that the migration process cannot proceed
   due to a database lock or a misconfiguration of the excluded settings.
 * **3. Request for Support**
 * I would like to know what the purpose of the query is and what could be the reason
   for sending it over and over.
 * Could the export issue I’m seeing be related to the queries?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Codexonics](https://wordpress.org/support/users/codexonics/)
 * (@codexonics)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18268894)
 * Hello, thanks for using the Prime Mover plugin! I’m sorry to hear you have experienced
   performance issues and other issues.
 * **For issue #1:**
 * This is strange since the plugin is not designed to run extensive queries in 
   real-time when not performing backups or migrations. It will only execute queries
   if needed during maintenance and migration.
 * Therefore, this issue is strange. Out of curiosity – we tried reproducing your
   setup in our local test environment with the following configuration to check
   if indeed the problem is reproducible:
    - Latest WordPress multisite setup.
    - Install all [popular WordPress plugins](https://wordpress.org/plugins/browse/popular/)
      and activate them on the network. This will simulate a heavy multisite with
      many plugins.
    - Install the [query monitor plugin](https://wordpress.org/plugins/query-monitor/)
      to monitor all database queries that have been executed.
    - Install the old version of Prime Mover 1.9.9 and activate the network.
    - Check if there are repeated queries that match with `UPDATE wp_sitemeta SET
      meta_value = 'a:12:{s:21:\"id_slug_type_path_map\";`
 * RESULT: _No matched queries found_.
    - Now upgrade the plugin to the latest version, Prime Mover 2.0.4, and check
      for repeated database queries.
 * RESULT: _Same, no matched queries found_.
 * We cannot reproduce the reported excessive queries in all the above tests.
 * **For issue #2: **Regarding your second issue of being unable to export using
   Prime Mover 2.0.3, we tried reproducing this following the above steps, and after
   upgrading to Prime Mover 2.0.4 (the latest version), the export still works.
 * Regarding the database lock, a check was added to ensure that only one export
   process can transact with the database export. This is to prevent errors and 
   optimize performance. This should not cause any issues on the multisite.
 * **Recommendation solution:** To resolve issues #1 and #2, we recommend installing
   the latest version of the Prime Mover plugin. This will ensure that you start
   with a fresh state that runs in the newest version. These are steps:
    - Login as network administrator.
    - Go to Network -> Plugins.
    - Delete all old versions of the Prime Mover plugin from the plugins. This will
      safely uninstall the plugin.
    - Clear and reset Freemius data on your site by following [this procedure](https://codexonics.com/prime_mover/prime-mover/faq-i-cannot-activate-license-please-help/#resetfreemius).
    - Install the latest Prime Mover version 2.0.4. This is recommended since it’s
      the most up-to-date with the latest stability and performance fixes.
    - Network activate Prime Mover 2.0.4, and in the opt-in screen, click “Skip”–
      this will simplify the activation.
    - When the plugin is successfully network activated – try doing an export and
      check if it works.
 * **If reported issues persist**
 * If the above recommendation cannot resolve the above-reported issues, we need
   to debug your site and check what is causing it. We will then know if this problem
   is related to your server or if an issue with the plugin happens only in a specific
   environment/set of plugins or setup.
 * To do this, please provide us the following:
    - SQL Database dump of your multisite where the issue happens.
    - Zipped off your entire plugin’s directory and themes.
    - Go to _Prime Mover -> Advanced -> Advanced Settings Panel -> Upload/Download
      Parameters_ -> Export site info and click “_Export site info_ “. This will
      download details of your site info, including your Prime Mover settings data.
      This is your site information log.
    - Put the above-requested files in a folder and zip them. Then, upload them 
      to Google Drive and send us a link to download them by [contacting us using this form](https://codexonics.com/contact/).
 * Our technical team will investigate this issue using the provided database, plugins,
   and themes. This will allow us to determine what is causing these performance
   issues and resolve them.
 * If the above assistance and workaround fix the issue, please mark this ticket
   as resolved; otherwise, please provide us with the requested files so we can 
   check further. Thank you again!
 *  Thread Starter [malimart](https://wordpress.org/support/users/malimart/)
 * (@malimart)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18270009)
 * Thanks for the detailed response.
 * Removing the plugin and updating to 2.0.4 did not help and I can’t dump the database
   because of GDPR.
 * The problems started after a failed exporting event, which is probably why it
   is hard to reproduce.
 * I’m suspecting the plugin removal did not remove all the database entries. Does
   prime mover use its own tables? I could not find any. It probably has its own
   entries in the wp_sitemeta table. Can you tell me what to look for so I can do
   a manual cleanup.
 *  Plugin Author [Codexonics](https://wordpress.org/support/users/codexonics/)
 * (@codexonics)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18270124)
 * Thanks for the update. It’s okay if we cannot check the database. As long as 
   you follow the above procedure, you should be fine as it clears most settings
   and old data. There is no need to manually clear this inside the database until
   we have further debugging information.
 * I would like to know the remaining issue so we can better assist you:
    - Have you managed to network activate Prime Mover 2.0.4?
    - If you can network activate the plugin, do the export work (with Prime Mover
      2.0.4) ?
 * If you are still unable to network activate the plugin, can you please share 
   if you see any errors?
 * However, if you have now network-activated the plugin and cannot export a package,
   please share some [debugging logs (site information log and migration log) ](https://codexonics.com/prime_mover/prime-mover/how-to-submit-debug-data-to-support/)
   sent via the developer [contact form](https://codexonics.com/contact/).
 * We will examine the logs and check if we see any issues so we can advise you 
   further. Thanks again!
 *  Plugin Author [Codexonics](https://wordpress.org/support/users/codexonics/)
 * (@codexonics)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18270161)
 * Regarding your other question, Prime Mover does not have custom tables in the
   database. It only stores settings in the `wp_sitemeta` table with a prefixed 
   option like “`prime_mover`.”
 * You can query it like:
   `SELECT * from wp_sitemeta WHERE meta_key LIKE '%prime_mover%'`
 * And it also stores user specific preferences in the user meta table; you can 
   also query it like:
 * `SELECT * from wp_usermeta WHERE meta_key LIKE '%prime_mover%'`
 * Please note that if you delete data from your database, you must first perform
   a manual dump. Thanks and please let me know if you still need any technical 
   assistance.
 *  Thread Starter [malimart](https://wordpress.org/support/users/malimart/)
 * (@malimart)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18271721)
 * I was able to network activate Prime Mover 2.0.4. The export didn’t work. In 
   the dashboard the progress stayed at 0%. This was in the logs, there was only
   one export running:
 *     ```wp-block-code
       2025-01-29 08:58:56 => Logged common event for blog ID 57873 from Codexonics\PrimeMoverFramework\utilities\PrimeMoverComponentAuxiliary::restoreExcludedOptions method: DB LOCK: Not being able to move setting prime_mover_excluded_settings_db_57873 from user meta to options in prime_mover_shutdown_actions hook using user ID: 91722 because the value is not an array or empty.
       ```
   
 * Another issue that is unique to version 2.0.4 is that in slowed down our entire
   network. Response times went from 500ms to 7s as soon as the plugin was activated.
   The situation normalized once the plugin was deactivated. This was not a problem
   with 2.0.3.
 * Now we basically have 3 different issues:
    1. Migration only works with versions up to including 1.9.9.
    2. All version are flooding the database with queries as soon as the plugin is 
       activated.
    3. Version 2.0.4 significantly slows down the site.
 * I’m manly interested in the second issue related to the database.
 * I will send a support ticket with logs to the contact you gave above.
 *  Plugin Author [Codexonics](https://wordpress.org/support/users/codexonics/)
 * (@codexonics)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18272271)
 * Thank you very much for the logs you sent via our contact form. We have received
   and analyzed them.
 * Based on the logs sent, you’ve got this critical error:
 * `PHP Fatal error: Uncaught Error: Call to undefined method Codexonics\PrimeMoverFramework\
   general\PrimeMoverMustUsePluginManager::getAutoBackupCronInitialized() `
 * This error means that the Prime Mover plugin manager script file is not updated
   when you upgrade Prime Mover to its latest version:
 * `/wp-content/mu-plugins/prime-mover-cli-plugin-manager.php`
 * We updated the script in the mu-plugins directory when upgrading from Prime Mover
   1.9.9 to 2.0.0+. This file is supposed to be auto-updated when you upgrade, but
   it has not been updated, which is strange. It could be because your mu-plugins
   directory is not writable, so the script has not been updated to its latest version.
 * This file is crucial since it controls the entire plugin’s operations at runtime,
   including export and import. If it is not updated, you will experience all these
   issues, including the inability to export and performance issues related to the
   database.
 * Let’s fix this manually to check if it works on your end; these are the steps:
    - Make sure you are using Prime Mover 2.0.4, the latest version.
    - Make sure the plugin is network deactivated.
    - Login to your WordPress directory via SFTP or your hosting file manager.
    - Delete this outdated Prime Mover plugin manager script file inside mu-plugins
      directory (if it exists):
 * `/wp-content/mu-plugins/prime-mover-cli-plugin-manager.php`
    - Copy this updated file from:
 * `/wp-content/plugins/prime-mover/scripts/prime-mover-cli-plugin-manager.php`
 * And paste it to the mu-plugins directory:
 * `/wp-content/mu-plugins/`
 * This updates the Prime Mover plugin manager script inside the mu-plugins directory
   to its latest version.
    - Finally, once the script is updated, network activate Prime Mover 2.0.4 again.
      The export should work with the latest version, and the plugin should operate
      normally, just as expected.
 * Please let me know if the above solution works and if you still need technical
   assistance. Thank you!
 *  Plugin Author [Codexonics](https://wordpress.org/support/users/codexonics/)
 * (@codexonics)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18297714)
 * This ticket has been closed due to inactivity. [Prime Mover 2.0.5-beta1](https://codexonics.com/prime-mover/beta/prime-mover-free.2.0.5-beta1.zip)
   is now available. It includes controls on the non-writable plugin manager script
   inside mu-plugins, ensuring you always use the latest mu-script version. It will
   be released in a few days.
 * If you still have the same issues, please re-test using the latest beta first.
   Then, open a separate ticket if you still need technical assistance. Thank you
   again!
 *  Thread Starter [malimart](https://wordpress.org/support/users/malimart/)
 * (@malimart)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18372037)
 * I successfully updated Prime Mover to 2.0.4. The plugin works, but the problem
   with excessive database queries remains.
 *     ```wp-block-code
       UPDATE wp_sitemeta SET meta_value = ... WHERE site_id = 1 AND meta_key = 'fs_accounts'
       ```
   
 * Upon activation the plugin sends thousand of queries per minut. It’s always the
   same query shown above. It massively degrades performance of the DB server.
 * I tried uninstalling, reinstalling, upgrading, downgrading nothing worked. I 
   finally solved the issue by manually deleting all Prime Mover options from the
   database.
 * Upon uninstallation some plugin files and DB entries are left behind. I uninstalled
   the plugin
 *     ```wp-block-code
       wp-cli plugin uninstall --deactivate prime-mover
       ```
   
 * then manually deleted the remaining folders
 *     ```wp-block-code
       rm -rI wp-content/uploads/prime-mover-export-filesrm -rI wp-content/uploads/prime-mover-lock-filesrm -rI wp-content/uploads/prime-mover-tmp-downloads
       ```
   
 * and finally the DB entries
 *     ```wp-block-code
       DELETE FROM wp_sitemeta WHERE meta_key LIKE '%prime_mover%';DELETE FROM wp_usermeta WHERE meta_key LIKE '%prime_mover%';
       ```
   
 * After deleting the DB entries and installing version 2.0.4 the plugin stopped
   spamming the queries. The problem has finally been solved.
 * The options `prime_mover_in_progress_packages` had a lot of entries even though
   no packages were in progress. Maybe that is what was causing the issue.
 *  Plugin Author [Codexonics](https://wordpress.org/support/users/codexonics/)
 * (@codexonics)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18372195)
 * Thank you for the feedback. For the first issue, the SQL query is coming from
   the Freemius SDK library. We created a [dedicated ticket for that here](https://github.com/Freemius/wordpress-sdk/issues/793)
   so Freemius developers will be aware of it and investigate it. Feel free to add
   more details on the GitHub ticket if needed.
 * The second issue should be handled with the latest versions of the Prime Mover
   plugin (Prime Mover 2.0.4/Prime Moer 2.0.5 beta (link shared above). In our tests
   here, as long as the [proper uninstallation procedure](https://codexonics.com/prime_mover/prime-mover/how-to-uninstall-prime-mover-plugin/)
   is followed, the options (including `prime_mover_in_progress_packages`, etc.)
   should be removed from the database. It also deletes those folders as long as
   no backup remains. Manually deleting those folders or options is no longer required.
 * For your update, thanks again for all the information and feedback!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Excessive Database Queries and Export Functionality Failure’ is closed
to new replies.

 * ![](https://ps.w.org/prime-mover/assets/icon-256x256.png?rev=2114612)
 * [Prime Mover - Migrate WordPress Website & Backups](https://wordpress.org/plugins/prime-mover/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/prime-mover/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/prime-mover/)
 * [Active Topics](https://wordpress.org/support/plugin/prime-mover/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/prime-mover/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/prime-mover/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Codexonics](https://wordpress.org/support/users/codexonics/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/excessive-database-queries-and-export-functionality-failure/#post-18372195)
 * Status: resolved