Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

What is key and non-key column wrt to indexes Expand / Collapse
Author
Message
Posted Tuesday, December 11, 2012 4:24 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:40 PM
Points: 248, Visits: 569
Hi,
Since this might be the most basic question hence i did not find its answer anywhere. Could anybody tell me what is mean by Key & Non-Key column with respect to indexes.
Post #1395027
Posted Tuesday, December 11, 2012 4:27 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 5:51 AM
Points: 5,142, Visits: 4,937
A key column is the column(s) that the index is created on, the non-key column are included columns

CREATE NONCLUSTERED INDEX idx1 ON Table1 (Col1, Col2) INCLUDE (Col3, Col4)

In the above example, Col1 and Col2 are key columns, Col3 and Col4 are non-key columns

CREATE CLUSTERED INDEX cidx ON Table1 (Col1)

In the above example Col1 is the key column, and all other columns in the table are classed as non-key columns, as the clustered index is the table.




Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger

Post #1395030
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse