[wp-trac] [WordPress Trac] #31595: Post and post meta query slow not fetch data takes approx 390 sec

WordPress Trac noreply at wordpress.org
Wed Mar 11 11:36:27 UTC 2015

#31595: Post and post meta query slow not fetch data takes approx 390 sec
 Reporter:  aloktiwari    |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
Changes (by boonebgorges):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


 Hi aloktiwari - `LIKE` queries against a longtext column like `meta_value`
 are always going to be fairly slow. And combining large tables with JOINs
 is always going to cause performance issues. You are doing both. There's
 not much that WP can do to improve this.

 My suggestions are as follows:
 - Stop using 'compare=LIKE'. It looks like you want to do strict
 comparisons anyway, so use `'compare' => '='`. This alone should improve
 performance quite a bit.
 - Use taxonomies instead of postmeta. I'm guessing that your data here is
 part of a number of controlled taxonomies. This seems more like "category"
 or "tag" type of data. Queries that use `tax_query` are going to be much
 faster than those using `meta_query`.
 - If you need true search capabilities at scale, consider an external
 search appliance like Solr or ElasticSearch.

Ticket URL: <https://core.trac.wordpress.org/ticket/31595#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list