[wp-trac] [WordPress Trac] #49278: Improve meta query

WordPress Trac noreply at wordpress.org
Wed Mar 23 10:28:13 UTC 2022


#49278: Improve meta query
-------------------------------------------------+-------------------------
 Reporter:  jillebehm                            |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Query                                |     Version:  5.3.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback early early-  |     Focuses:
  like-actually-early has-unit-tests             |  performance
-------------------------------------------------+-------------------------

Comment (by craigfrancis):

 As we have a Dev Chat today, I'll summarise my conversation with Mark so
 far:

 - The current patch does not change anything if the query uses `OR` (ref
 `$this->has_or_relation`), which does not help @jillebehm
 ([https://gist.github.com/craigfrancis/9230be877423e73a28475b061495fee7
 rough example]). This is because `find_compatible_table_alias()` will try
 to re-use an existing alias, which would have specified the `meta_key`
 from the first condition.
 - In my own basic tests, which does not represent real data, I was able to
 get similar improvements by changing the field to `varchar(191)` (ref
 #33885), or running `OPTIMIZE TABLE`, because the updated INDEX info would
 lead to a much better query execution plan.
 - I have a small concern about how the `get_meta_sql` filter/hook might be
 affected; e.g. a plugin that modifies the 'join' string (e.g. to apply
 their own version of this fix), but I think they should expect changes.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49278#comment:25>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list