• Resolved stofa

    (@stofa)


    Hi There,

    A faster version of this query :

    $identifier = $wpdb->get_var(“SELECT COLUMN_NAME
    FROM information_schema.COLUMNS
    WHERE
    TABLE_NAME = ‘$wpdb->users’
    AND COLUMN_NAME = ‘identifier'”);
    Can be obtained by adding condition on TABLE_SCHEMA column in thi way :

    $identifier = $wpdb->get_var(“SELECT COLUMN_NAME
    FROM information_schema.COLUMNS
    WHERE
    TABLE_NAME = ‘$wpdb->users’
    AND TABLE_SCHEMA=’$wpdb->dbname’
    AND COLUMN_NAME = ‘identifier'”);

    This is because, when there is a huge number of databases and tables, the access to information_schema views requires to specify the TABLE_SCHEMA in the WHERE condition in order to have a better query’s execution time.

    Thanks,

    Stofa.

Viewing 1 replies (of 1 total)
  • Plugin Author miniOrange

    (@cyberlord92)

    Hi Stofa,

    Thank you for the feedback.

    We will add this change in our next update.

    Thanks

    • This reply was modified 8 years ago by miniOrange.
Viewing 1 replies (of 1 total)

The topic ‘Query on information-schema’ is closed to new replies.