[wp-trac] [WordPress Trac] #52360: speed up update_meta_cache with easy fix
WordPress Trac
noreply at wordpress.org
Fri Aug 30 01:02:43 UTC 2024
#52360: speed up update_meta_cache with easy fix
-----------------------------------+------------------------------
Reporter: vladislavdavarashvili | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
-----------------------------------+------------------------------
Comment (by peterwilsoncc):
Replying to [comment:3 antonynz]:
> ... it could have an impact if post meta order was important in custom
code? ...
I think it's important to consider this use case, as the order returned
may differ depending on different database engines. Using MySQL 8.0.36 I
didn't see a difference but that may have been for any number of reasons.
It doesn't make this ticket a dead end, it would be worth comparing the
performance for sorting via the database with sorting via PHP. If PHP is
consistently faster then the code could become:
{{{#!php
<?php
$meta_list = $wpdb->get_results( "SELECT * FROM $table WHERE $column IN
($id_list)", ARRAY_A );
$meta_list = wp_list_sort( $meta_list, $id_column );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52360#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list