• hi guys,

    i have noticed on my query monitor that a query runs slow, over 6 seconds which it should be doing it much less then 0.001.

    the query is as follows;

    SELECT DISTINCT meta_key
    FROM wphq_postmeta
    WHERE meta_key NOT BETWEEN ‘_’
    AND ‘_z’
    HAVING meta_key NOT LIKE ‘\\_%’
    ORDER BY meta_key
    LIMIT 30

    the error is coming from this template wp-admin/includes/template.php:613

    which is this;

    * @param array|null $keys Pre-defined meta keys to be used in place of a postmeta query. Default null.
    * @param WP_Post $post The current post object.
    */
    $keys = apply_filters( ‘postmeta_form_keys’, null, $post );

    if ( null === $keys ) {
    /**
    * Filter the number of custom fields to retrieve for the drop-down
    * in the Custom Fields meta box.
    *
    * @since 2.1.0
    *
    * @param int $limit Number of custom fields to retrieve. Default 30.
    */
    $limit = apply_filters( ‘postmeta_form_limit’, 30 );
    $sql = “SELECT DISTINCT meta_key
    FROM $wpdb->postmeta
    WHERE meta_key NOT BETWEEN ‘_’ AND ‘_z’
    HAVING meta_key NOT LIKE %s
    ORDER BY meta_key
    LIMIT %d”;
    $keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( ‘_’ ) . ‘%’, $limit ) );
    }

    if ( $keys ) {
    natcasesort( $keys );
    $meta_key_input_id = ‘metakeyselect’;
    } else {
    $meta_key_input_id = ‘metakeyinput’;
    }

    any guidance or help would be great. as i am really confused on what to do, never had the issue or problem before.

    Marc

    thanks in advance

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Slow queries when i edit page on the backend.’ is closed to new replies.