Complex meta queries with a large number of meta values to find can be slow. Each meta key you query for generates one more JOIN in the query, and if you have a large database, it can be slow. You can try few things:
- Optimize your database tables, it is possible that you have a lot of orphaned data that can contribute to database query speed.
- Try limiting the number of posts query returns, if you have a lot of records in the results set that can cause speed problems too.
- Contact your hosting (or do it yourself if you have access) to check MySQL slow query log to see why the query is slow, and maybe do some optimization on the MySQL server settings for better caching.
Related Posts:
- WP Query Args – Title or Meta Value
- Meta query with string starting like pattern
- how to show posts that are missing a meta_value
- Does tax_query really beats meta_query in all situations?
- Query WooCommerce orders where meta data does not exist
- Execute a large WP_Query with many “AND” Meta_Queries?
- Query all posts where meta value is empty
- WP_Query min and max values
- querying with custom meta field with meta_query
- Order by two meta keys
- A WP_Query that will look for posts after 2 weeks ago OR with a certain meta value
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- Query by meta_key and order by meta_value_num return orderby date
- Wp_query order by multiple custom fields?
- WordPress altering my custom query, How to fix it?
- Order by meta_key in custom post type doesn’t affect the query
- How to create/modfiy WP_Query to search in post title OR custom field?
- Use meta_query to display events by date in custom field
- How to show recent and upcoming birthdays using meta_query
- Multiple meta queries but arrange by specific meta value order
- Order Posts by meta value AND published date
- Using WP_Query and WP_Meta_Query Outside of WordPress
- If two first numbers exist in wp_meta_query value
- WP_Query on custom field and order results
- pre_get_posts order by not working
- WP_Query filter and order by meta ordering by wrong joined table
- Tax query clause inside a meta query clause?
- What is the random string I am seeing when I use get_query_var?
- Optional Meta Query
- How do I make a meta_query OR relation work? [closed]
- meta_query in WP_Query value is not accepting array
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Changing sort order for presentation by Jetpack infinite scroll
- get posts by meta_key from inside key of post meta
- Help optimizing slow WP_Query with meta_query
- meta_value_num not ordering all items
- Meta Queries – should nesting work after WP 4.1?
- Meta Query relation “AND” then set array accordingly
- 2 weeks ago from meta query meta value
- WP_Query with meta_query dosen’t return results
- Query with meta_query and tax_query together not working properly
- Array as ‘key’ in WP_Query
- Is it possible to query a custom field where the value is between two fields?
- Filter posts by comparing custom meta value against postdate
- How to provide meta_key array to wp_query?
- Searching for meta_key returns 0 posts
- meta_query fails to compare on values containing apostrophes
- How to set up hierarchical relationships without using plugins / meta query
- Check if searched number is within the post meta value
- Meta query compare for ID’s greater than specific ID
- Is it possible to add relation between meta_query and tax_query?
- add_query_arg to compare and display events from a certain date
- Show single posts date, in a page of posts
- WP_Query Class custom field parameters
- WP_Query not returning correct result with meta_query parameter
- meta_query where the meta value is not the post title
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- Query on meta values and post title
- How do i create a custom post query when the meta value is an array?
- Custom Meta Query doesn’t work the same on two site
- meta_query with meta values as serialize arrays
- WP Query – grouping posts by same meta key, adding together values from another key
- Woocommerce Get Orders By Meta Value
- meta_query is overriding default search
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Query for current post
- Custom query to retrieve oldest post and retrieve others with date interval
- WP_User_Query Orderby Not Working
- Unusual high query of user meta data
- Very slow query generated getting meta data from posts
- WordPress Query optimaization for slow query
- How to filter on placeholder image
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Meta query doesn’t remove placeholder escape before query
- WP Query Meta Query
- Query custom meta value – post view and date meta
- What is the best way to reset a search on a meta_key / meta_value?
- How can I modify standard search query to include also ACF custom fields values?
- Custom WP_query and integrating into theme file
- WP_Query – show posts where meta value and user_email match
- WP Meta Query at depth 2
- Best way to Order Post in Home without a plugin
- WP_Query using meta_query with LIKE doesn’t return what it should
- Is there any difference between below WP_Query code snippets?
- Return a single custom post from multiple meta queries
- Sorting: custom query with orderby meta_value_num THEN by title
- query post based on comparison
- Including ‘cat’ => $cat breaks meta_query
- meta_query compare not doing what I want it to do
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- Can’t figure out query logic
- WP_Query orderby not working on custom post_type
- 294 Queries on Mainpage of WordPress
- How do I have multiple metaqueries inside one wordpress query
- Display only posts with thumbnails