Click here to monitor SSC
SQLServerCentral is supported by Redgate
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
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: Tuesday, March 22, 2016 5:42 AM
Points: 298, Visits: 797
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



Group: General Forum Members
Last Login: Thursday, September 1, 2016 2:56 AM
Points: 5,969, Visits: 6,067
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


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
When a question, really isn't a question - Jeff Smith
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