Do index names have to be unique accross the entire sql server database, or just for that table?
For example, should I name my index: IX_OrderLoadCarrierDelivery_OrderLoadID
for the OrderLoadID
column of the OrderLoadCarrierDelivery
table. Or should I just name it IX_OrderLoadID
Thanks!
If you feel like your data should be UNIQUE , use a unique index. You may think it's optional (for instance, working it out at application level) and that a normal index will do, but it actually represents a guarantee for Mysql that each row is unique, which incidentally provides a performance benefit.
Unique indexes are indexes that help maintain data integrity by ensuring that no rows of data in a table have identical key values. When you create a unique index for an existing table with data, values in the columns or expressions that comprise the index key are checked for uniqueness.
Explanation: Indexes can also be unique, like the UNIQUE constraint.
There is no difference between Unique Index and Unique Constraint. Even though syntax are different the effect is the same. Unique Constraint creates Unique Index to maintain the constraint to prevent duplicate keys.
They have to be unique for the table or view they were created for.
Here is a reference on msdn that details this.
FTA:
index_name
Is the name of the index. Index names must be unique within a table or view but do not have to be unique within a database. Index names must follow the rules of identifiers.
I believe the convention is
IX_FieldName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With