sql server - Default Index on Primary Key -


Does SQL Server make an index on the primary key on the default? If yes, then what kind of index is that? If an index is not suitable for selection of primary key?

I use SQL Server 2008 R2

Thanks.

You can easily set the first part of this for yourself

  Create table x (id int primary key) * select * from sys .indexes where object_id = object_id ('x')  

returns

Edit: I need another case Ntioned

  to create the table T2 (id int no null, cx int) Create the package index ixc on the A dbo.t2 (cx asc) alter table dbo.t2, select constrain pk_t2 primary key (id) from * Sys.indexes where object_id = object_id ('t2')  

Returns

  object_id name index_id type type_desc is_unique data_space_id ignore_dup_key is_primary_key is_unique_constraint fill_factor is_padded is_disabled is_hypothetical allow_row_locks allow_page_locks has_filter filter_definition ----------- -------- ----------------------------------- ---- ----------- -------------------------------- ----------- ---------- ---- -------------- ----------- --------- ----------- - -------- ----------- ---------- ----- --------------- - --------------------------------- --------------------- ----- 34099162 ixc 1 1 CLUSTERED 0 1 0 0 0 0 0 1 1 0 NULL 34099162 pk_t2 2 2 nonclasser 1 1 0 1 0 0 0 1 1 0 Taps / Cod E> 

There is no golden rule in relation to the other part depending on your personal query workload, and what your PK is.

A non-clustered index will be cured to satisfy personal lookup by the primary key. If you are questioning against the borders, then these matching packages will serve well with the index, but a covered non-clustered index can also be adequate.

You have to consider the index width of the index index in particular

I recommend the book to read more about the problems.


Comments