What is the significance of the index name when creating an index in MySQL?

前端 未结 3 609
渐次进展
渐次进展 2020-12-10 01:28

I\'ve done something like this in order to use on duplicate key update:

CREATE UNIQUE INDEX blah on mytable(my_col_to_make_an_index);

3条回答
  •  生来不讨喜
    2020-12-10 01:29

    The naming is to allow global namespace, and help better understand on the table schema.

    The index name is very useful for forcing index hint. Try not using the same name for both index and column (ambiguous), and camel case is meaningless for system like Windows (which does not allow case sensitivity).

    For example, like this:

    unique key cloth_id_uniq (cloth_id); 
    >>allow people knowing this an unique key on column cloth_id
    
    fulltext key description_ft (description); 
    >>allow people knowing this index is fulltext on column description
    

    I do not think there is a standard naming convention, whatever seems intuitive will help most.

提交回复
热议问题