Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding PK index
Message
De
17/01/2016 13:10:42
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
À
17/01/2016 10:38:16
Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01629831
Message ID:
01629852
Vues:
32
>>>Hi,
>>>
>>>When I make a field to be a Primary key (the field is Int type and Identity is set ON), SQL server creates a KEY named PK_Table_Name and at the same time it creates a Unique Non-Clustered index of the same name (e.g. PK_Table_Name). Will SQL use this index when optimizing searches that include the PK field?
>>>
>>>The reason I am asking is that I noticed that - somehow - when I was creating the table I created a separate Non-Unique and Non-Clustered Index On the same fields (which is the PK field). Therefore, my question is, would it be Ok to delete this "extra" index that I created?
>>>
>>>TIA
>>
>>That it makes the primary key clustered automatically is probably a bad move. The key has no meaning. Performance may be enhanced by clustering on another field.
>
>Huh?? A clustered key won't be created automatically unless you specify it as such.

Just tried this (Sql2014), copied a script for one of the tables, changed the name, removed the clustered clause, ran the script, the PK was clustered.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform