Covering indexes

Support MB Custom Table Covering indexes

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #10374
    david.hdavid.h
    Participant

    Hi Anh,

    I would like to add some SQL indexes to MetaBox custom tables, what is the best way to achieve that?

    Thanks

    #10384
    Anh TranAnh Tran
    Keymaster

    Hi David,

    When you create a table, you can set which column(s) are indexed. Just put the columns you want to index in the last param of MB_Custom_Table_API::create function.

    For example, this code will index the column email:

    MB_Custom_Table_API::create( 'my_custom_table', array(
        'address' => 'TEXT NOT NULL',
        'phone'   => 'TEXT NOT NULL',
        'email'   => 'VARCHAR(20) NOT NULL',
    ), array( 'email' ) );

    See the docs for more info.

    If you want to do that manually with raw SQL, you can do that via a tool like phpMyAdmin.

    #10387
    david.hdavid.h
    Participant

    Hi Anh,

    The MetaBox API won't work for my needs, see example:

    http://www.unofficialmysqlguide.com/covering-indexes.html

    I'll add the index manually.

    Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Covering indexes’ is closed to new replies.