Skip to content

Slow queries generated by Zoninator #75

Description

@gudmdharalds

We have seen slow queries being generated by Zoninator, in particular a query that looks like this:

SELECT wp_posts.ID FROM wp_posts WHERE ?=? AND ( wp_posts.post_date > ?) AND wp_posts.ID NOT IN (?, ?, ?, ?, ?, ?, ?, ?) AND (((wp_posts.post_title LIKE ?) OR (wp_posts.post_excerpt LIKE ?) OR (wp_posts.post_content LIKE ?))) AND wp_posts.post_type = ? AND ((wp_posts.post_status = ? OR wp_posts.post_status = ?)) ORDER BY wp_posts.post_date DESC LIMIT ?, ?

It is in particular the NOT IN part that causes issues, as when data grows in wp_posts, there is more to exclude when processing the query. This can lead the database to overload, causing sites to have performance issues.

Is there any way to rewrite this without the NOT IN?


This issue originated as a VIP Request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions