MySQL: low cardinality/selectivity columns = how to index?

前端 未结 7 1274
既然无缘
既然无缘 2020-12-04 15:31

I need to add indexes to my table (columns) and stumbled across this post:

How many database indexes is too many?

Quote: “Having said that, you can clearly

7条回答
  •  隐瞒了意图╮
    2020-12-04 16:11

    If the data is distributed like 50:50 then query like where status="enabled" will avoid half scanning of the table.

    Having index on such tables is completely depends on distribution of data, i,e : if entries having status enabled is 90% and other is 10%. and for query where status="disabled" it scans only 10% of the table.

    so having index on such columns depends on distribution of data.

提交回复
热议问题