Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#41219 closed defect (bug) (duplicate)

WP_Query gets slow down with multiple meta query combinations

Reported by: babatechs's profile babatechs Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.8
Component: Query Keywords:
Focuses: Cc:

Description

Hi,
Recently I am working on a project in which i have to handle the complex data based on post metas. I needed to query the posts with multiple pairs of meta key and values and both joined by AND while same meta key can also contain different values in database. So when query reaches up to 10 joins of MySQL for postmeta table it gets too slow to respond, you can check by the case i described and if you feel no problem then let me know so I can send you the query request.

I am also trying to find its solution, but can't succeeded yet.

Have a great day,
thanks.
Majid

Change History (1)

#1 @boonebgorges
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @babatechs - Welcome to WordPress Trac!

The slowness of these sorts of queries is pretty well documented. The meta tables are not really designed to serve as advanced filters of this sort; if you need to do extensive filtering by metadata, it might be better suited for a taxonomy (which generally scales better if used correctly).

That said, we're looking at alternative strategies for AND queries in #30044. Please follow that ticket, and join the conversation if you have data or ideas to move things forward. Thank you!

Note: See TracTickets for help on using tickets.