Which index should I use on binary datatype column mysql

大城市里の小女人 提交于 2019-12-05 12:01:48
  1. Can I use indexes on binary column, my default table collation is latin1 - default collation?

    Yes, you can; collation is only relevant for character datatypes, not binary datatypes (it defines how characters should be ordered)—also, be aware that latin1 is a character encoding, not a collation.

  2. Which Indexing mechanism should I use Btree or Hash, for getting high performance? I need to update or add 100 of rows per seconds.

    Note that hash indexes are only available with the MEMORY and NDB storage engines, so you may not even have a choice.

    In any event, either would typically be able to meet your performance criteria—although for this particular application I see no benefit from using B-Tree (which is ordered), whereas Hash would give better performance. Therefore, if you have the choice, you may as well use Hash.

    See Comparison of B-Tree and Hash Indexes for more information.

  3. What other things should I take care of to get best performance?

    Depends on your definition of "best performance" and your environment. In general, remember Knuth's maxim "premature optimisation is the root of all evil": that is, only optimise when you know that there will be a problem with the simplest approach.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!