HPOS - Made the query for retrieving meta keys more performant (#46985)
* Modified query for fetching meta key, making it more perfomant * added changelog * Improved query when include_private is true * Address review feedback * Address review feedback
This commit is contained in:
parent
6066c082b0
commit
1ba1e91a7e
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: performance
|
||||
|
||||
HPOS - Made the query for retrieving meta keys more performant
|
|
@ -250,7 +250,7 @@ abstract class CustomMetaDataStore {
|
|||
$query = "SELECT DISTINCT meta_key FROM {$db_info['table']} ";
|
||||
|
||||
if ( ! $include_private ) {
|
||||
$query .= $wpdb->prepare( 'WHERE meta_key != \'\' AND meta_key NOT LIKE %s ', $wpdb->esc_like( '_' ) . '%' );
|
||||
$query .= $wpdb->prepare( "WHERE meta_key !='' AND meta_key NOT BETWEEN '_' AND '_z' AND meta_key NOT LIKE %s ", $wpdb->esc_like( '_' ) . '%' );
|
||||
} else {
|
||||
$query .= "WHERE meta_key != '' ";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue