Is normal MySql index required when we have Composite index

前端 未结 2 1686
旧时难觅i
旧时难觅i 2021-01-23 11:20

We have MySql table having 25 million rows

Following are the columns in table

c_id,c_name,s_id,l_type,l_time,message,domain

among above

2条回答
  •  滥情空心
    2021-01-23 12:11

    Any prefix of a composite index will be used as an index by itself as well. So if you have a composite index on (domain, log_time, log_type), it's equivalent to having indexes on domain and (domain, log_time). There's no need to have these indexes separately as well, they will be redundant and waste space.

    So you can safely remove the index on domain when you add this composite index.

提交回复
热议问题