Mysql covering vs composite vs column index

后端 未结 4 695
走了就别回头了
走了就别回头了 2020-11-30 00:51

In the following query

SELECT  col1,col2
FROM    table1
WHERE   col3=\'value1\'
  AND   col4=\'value2\'

If I have 2 separate indexes one on

4条回答
  •  佛祖请我去吃肉
    2020-11-30 00:56

    This is a question I hear a lot and there is a lot of confusion around the issues due to:

    • The differences in mySQL over the years. Indexes and multiple index support changed over the years (towards being supported)

    • the InnoDB / myISAM differences There are some key differences (below) but I do not believe multiple indexes are one of them

    MyISAM is older but proven. Data in MyISAM tables is split between three different files for:- table format, data, and indexes.
    InnoDB is relatively newer than MyISAM and is transaction safe. InnoDB also provides row-locking as opposed to table-locking which increases multi-user concurrency and performance. InnoDB also has foreign-key constraints.
    Because of its row-locking feature InnoDB is well suited to high load environments.

    To be sure about things, make sure to use explain_plan to analyze the query execution.

提交回复
热议问题