• Resolved slservice33

    (@slservice33)


    Hi, I’m debugging why my wordpress admin is sometimes much slower to load pages.

    Using query monitor I can see that when my wp-admin is slow the number of woocommerce plugin database queries is much higher, around twice as many.

    The increased database queries will last for a week or two then go back to normal.

    Can you tell me why this might happen and what I can do about it ?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @slservice33

    This issue could be due to multiple reasons, such as a surge in traffic, server issues, or possibly a conflict with another plugin. It’s also possible that the WooCommerce plugin is processing more data during these periods, hence the increase in database queries.

    To resolve this, you could try the following:

    1. Ensure your WooCommerce plugin, WordPress, and all other plugins are up-to-date.
    2. Optimize your database regularly. This can be done manually or by using plugins such as WP-Optimize.
    3. Check for plugin conflicts. Deactivate other plugins one by one to see if the issue persists. If the issue resolves after deactivating a particular plugin, you’ve found the conflict.
    4. Use a CDN and cache plugin. Also, install the Index WP MySQL For Speed and Fast Woo Order Lookup plugin.
    5. If the issue persists, consider reaching out to your hosting provider to check if there are any server-related issues.

    I hope this helps! If you need further assistance, feel free to contact us.

    Thread Starter slservice33

    (@slservice33)

    I’ve already tried all the things above.

    The database queries are logged by the query monitor plugin which is I believe is reliable and accurate.

    And with such sudden and significant changes in the number of queries logged by query monitor as coming from the woocommerce plugin I am not mistaken in finding this issue.

    This problem significantly affects the performance of my server when I am working on wp-admin pages. (I would estimate around twice as many queries with twice the cpu load per page)

    You dont seem to have any realistic ideas as to the cause and I will keep monitoring it to see if I can spot what all the extra queries are related to. Though as there are hundreds of queries its not easy.

    Maybe you can suggest something to look out for in these extra queries that could indicate what is causing them ?

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @slservice33

    In order to better understand what might be causing these additional queries, I would recommend looking for patterns in the queries themselves. For instance, are they related to a specific product, order, or customer data? Are they related to a certain WooCommerce function or feature like updating product stock, processing orders, or recalculating taxes?

    Also, try to correlate the time of the increased queries with any specific events on your website. For instance, are they happening during a product import, a sales event, or when certain cron jobs are running?

    Finally, I would recommend checking if any scheduled tasks are running during these periods. WooCommerce uses WordPress’s built-in cron system for scheduling tasks like updating product stock status, sending out emails, etc. If a task is stuck or is running more frequently than it should, it could cause an increase in database queries.

    I hope this gives you a starting point for further investigations. If you need more assistance, don’t hesitate to ask.

    Thread Starter slservice33

    (@slservice33)

    Interesting, though it is extra woocommerce plugin queries on every admin page all the time.

    I’ve actually not yet tried https://www.ads-software.com/plugins/fast-woo-order-lookup/ or https://www.ads-software.com/plugins/index-wp-mysql-for-speed/

    I will try some more things and see if I get any improvements.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @slservice33

    Those plugins can be helpful in optimizing your database and reducing the load time.

    Also, keep in mind that WooCommerce, like any other plugin, will have a footprint on your database. The number of queries can increase depending on the number of products, orders, and other data related to WooCommerce on your site.

    If the issue persists even after trying these plugins, please consider reaching out to a developer or a professional who specializes in WordPress and WooCommerce optimization. They can help you identify the root cause and provide a tailored solution.

    Please keep us updated on your progress, and don’t hesitate to ask if you have any other questions or concerns.

    Thread Starter slservice33

    (@slservice33)

    i have installed both fast woo order lookup and index wp mysql for speed plugins and wow what an immediate improvement.

    The number of queries is back to normal and I cant remember my woocommerce admin pages ever being so fast for loading and also fast for searching.

    Thanks for you help, my server CPU is working much less hard !

    Thread Starter slservice33

    (@slservice33)

    Also I should note that my leaving the query monitor plugin running constantly also placed even more load on my already struggling server.

    Hi @slservice33,

    We’re thrilled to know that the plugins have significantly improved your website’s performance! It’s always great to know when our suggestions have a positive impact.

    If it’s not too much to ask, we’d love if you could leave us a review:?https://www.ads-software.com/support/plugin/woocommerce/reviews/.

    Thank you.

    Thread Starter slservice33

    (@slservice33)

    sadly it worked really well for a few hours now its back to slow admin pages with lots of extra queries.

    (The additonal queries below are recorded with redis object caching, without redis there is hundreds)

    Additional queries recorded by query monitor loading the woocommerce orders overview page:

    caller – Automattic\W\A\N\DataStore->read()
    normally 2 queries
    when slow 11 queries

    caller – Automattic\W\A\N\DataStore->read_actions()
    normally 2 queries
    when slow 11 queries

    caller – Automattic\W\I\D\O\OrdersTableDataStore->get_order_data_for_ids()
    normally 40 queries
    when slow 100 queries

    Any ideas what might cause those callers to make the extra queries ?

    Thread Starter slservice33

    (@slservice33)

    sorry please ignore that those queries are due to different settings. My woocommerce plugin queries are not high any more.

    My current slow page load and high peak memory use are coming from something else. I’ll have to try other avenues.

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello slservice33,

    Thank you for your reply.

    I am glad to know that you found the cause of the problem.
    I hope you find a solution and manage your memory usage.

    Please don’t hesitate to contact us again if you have any WooCommerce questions.
    We are here to help ??

    Best regards.

    Thread Starter slservice33

    (@slservice33)

    I’ve found the reason. Opcache memory was full and so was only working for 1 site at a time.

    Using the plugin WP OPcache I can see what opcache is doing.

    Then for my server I edit the opcache config file which in my case is 
    sudo nano /etc/php/8.1/cli/conf.d/10-opcache.ini

    I added these settings:
    opcache.memory_consumption=512
    opcache.interned_strings_buffer=64
    opcache.max_accelerated_files=32500
    opcache.revalidate_freq=60
    opcache.enable_cli=1
    opcache.enable=1

    restart php which in my case is 
    sudo service php8.1-fpm restart

    and both sites now work the same.

    Plugin Support Rajesh K. (woo-hc)

    (@rajeshml)

    Hello @slservice33,

    Congratulations on identifying and resolving the issue with Opcache memory! That was some great detective work, and I’m glad you were able to find a solution.

    Thank you for sharing the solution and contributing to the WooCommerce Community. This could help others who might be facing similar issues.

    Should you have further inquiries, kindly?create a new topic here.

    Thanks!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Increase in Woocommerce Database Queries’ is closed to new replies.