mysql - Decision to use KEY or UNIQUE KEY -


i understand unique key unique index , key non-unique index. have read in case of unique index'es inserting data might result in io.

if don't have rely on db unique-ness , still want fast lookup's using column 'b' suggest use non unique index (key) instead of unique index (unique key)?

both unique , non-unique indexes result in i/o operations insert, delete, , update statements. amount of index overhead should pretty same. difference unique indexes might result in failure of insert or update under normal use (of course, operations might fail other reasons, such disk being full, unusual circumstance).

i don't understand statement: "if don't have rely on db unique-ness". unique attribute in table description of column/columns comprise key. 1 of functions of database maintain integrity of data, let database designed for.

as performance, don't think there significant difference between unique , non-unique indexes. unique indexes may slightly more optimized operations because compiler knows single lookup returns 1 row. difference between index lookup , index scan returns 1 row pretty small in practice.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -