Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are 'name' and 'symbol' in MySQL indexes? [closed]

Primary Key definitions can have a optional symbol value, while Uniques can have both symbol and name. What are these, and what is their differences? And what is best practices to use them?

like image 428
user5483434 Avatar asked Jan 06 '23 23:01

user5483434


1 Answers

symbol is the name of the constraint. Should you later need to drop, disable or re-enable the constraint you identify it to the system using this symbol.

index_name is the name of an index created using CREATE INDEX which is to be used to enforce the UNIQUE constraint. (An index is a database object which is separate from the table it indexes.) If you do not specify the name of an existing index, the system will generate an index for you, and if you later disable the constraint the index will automatically be dropped and must be recreated when the constraint is re-enabled. If you do specify an existing index, it will not be dropped and recreated with the constraint, thus saving considerable time and processing power. Some other platforms also allow you to specify an existing index to enforce a Primary Key.

Hope that helps.

like image 166
Darwin von Corax Avatar answered Jan 10 '23 08:01

Darwin von Corax