Home > database >  Mysql general index and the only problem of efficiency index
Mysql general index and the only problem of efficiency index

Time:09-20

Such as user login support with binding email login, not every user binding the mailbox, so email is null then should be allowed to establish a unique index, or set the default empty strings, establish common index?
I also want to ask next unique index does not including field is null in the scope of the data?

CodePudding user response:

Allow null, you in establishing a unique index is meaningless, according to your description, email login with less, then the statistics about your first system which login method is the most commonly used, on up to perform the login SQL in the index, specific index type depending on the business

CodePudding user response:

If you don't need to use the only index to guarantee uniqueness constraints, then create a common index,
Ordinary index when positioning data only for more than a unique index pointer to a node traversal, query performance of the two basic may be regarded as equal,
But the only index will make the change of MySQL buffer failure, also lose a optimize performance characteristics,
  • Related