Skip to content

Could Multi-DB be effecting Marketpress queries #3

@mrbm

Description

@mrbm

https://premium.wpmudev.org/forums/topic/bug-gigantic-amount-of-queries-in-marketpress-if-the-shopping-cart-is-empty

Just posted this, have done other research, but perhaps me seeing a problem with queries can help. Perhaps this high query count when things are not in the shopping cart are related to multi-db? Posted steps on replication:

Multisite
MarketPress WPMU Dev
Multi-DB plugin
https://wordpress.org/plugins/query-monitor/

Set up a category, in that category place 9 products. Each product should have the variations 3 sizes and 3 colors each with their own image. That's 9 variations in all per product. Pretty normal.

now visit the site with 0 items in the shopping cart.

There will be roughly 1200 queries and SUPER slow load.

Now add 1 item to the shopping cart and visit that same category. The query count has now dropped to roughly 320 queries with reasonable load times (it doesn't seem to be doing any image resizing in the background possibly)

Is this related to Multi-DB or are you seeing this same scenario play out on you multi-site set up.

On that category page, WITHOUT anything in the shopping cart, there are 473 queries made to:

SELECT SQL_CALC_FOUND_ROWS wp_4_posts.ID
FROM wp_4_posts
WHERE 1=1
AND wp_4_posts.ID NOT IN  (A CHANGING POST ID IN MULTIPLES OF 30)
AND wp_4_posts.post_type = 'product'
AND (wp_4_posts.post_status = 'publish'
OR wp_4_posts.post_status = 'private')
ORDER BY wp_4_posts.post_date DESC
LIMIT 0, 3

However when there is 1 item in the shopping cart, this type of query is only made 95 times.

IN addition this query is always followed by this query:
SELECT FOUND_ROWS()
Further adding to the query count..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions