Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie question on creating index
Message
General information
Forum:
Microsoft SQL Server
Category:
Database design
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01243713
Message ID:
01243817
Views:
21
This message has been marked as the solution to the initial question of the thread.
>1. I want to create a couple of index keys for a table. At this point I want to learn how to do it using SQL Server Management Studio, visually. I opened SQLSMS, go to my database, to the table. Then I clicked on Table Designer menu and on the Indexes/Keys item. The Indexes/Keys window is empty. And I thought I would see at least on index key there, for the Primary key (as I read in the BOL that SQL Server automatically creates a clustered index for a Primary key in a table). If not in this window, where do you see the clustered index keys (that are automatically created by SQL Server)?

All fields involved in PK are marked with key icon in the grid. Did you see such things?
To see ALL indexes you could script the table, Right Click on Table name in TreeView and select Script Table as CREATE To.


>2. Then I clicked on Add button of the Indexes/Keys window. SQLSMS automatically creates an index for the primary key, naming it IX_MYPRIMKEY. My question is, if a clustered index on the Primary key is already exist, does it make sense to delete this index?

No, SSMS names that way only regular indexes, not PK ones. To create a PK index you must Select ALL fields you want and press "Set Primary Key" icon (that one with key icon).

I don;t see any reasons to change CLUSTERED status for the PK. Yes that slows down your INSERT, DELETE statements but you have a huge speed difference for your queries.
>
>3. It looks like SQLSMS names indexes with a prefix IX_. How important it is to maintain this convention?

Not important at all, just don't name the PK_. You are not able to use any indexes (like in VFP) the query optimizer choose which index to use.


>4. When I created an index on any column the value in Data Space Specification is always PRIMARY. What does it mean?

How you create them? If you press key button Yes they are ALWAYS PRIMARY. :-)


>Thank you in advance for your help.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform