Here's a quick test I threw together to see what happens:
IF OBJECT_ID('dbo.KeyTest', 'U') IS NOT NULL
BEGIN;
DROP TABLE dbo.KeyTest;
END;
CREATE TABLE KeyTest
(
ID INT NOT NULL
IDENTITY(1, 1),
OtherDate CHAR(500) DEFAULT 'A'
);
CREATE CLUSTERED INDEX CX_KeyTest ON dbo.KeyTest(ID);
GO
INSERT INTO dbo.KeyTest
(
OtherDate
)
SELECT TOP 500
AC.name
FROM
sys.all_columns AS AC;
GO
SET STATISTICS IO ON;
SELECT
KT.ID
FROM
dbo.KeyTest AS KT;
SELECT
*
FROM
dbo.KeyTest AS KT;
SET STATISTICS IO OFF;
GO
CREATE UNIQUE NONCLUSTERED INDEX UX_KeyTest ON dbo.KeyTest(ID);
GO
SET STATISTICS IO ON;
SELECT
KT.ID
FROM
dbo.KeyTest AS KT;
SELECT
*
FROM
dbo.KeyTest AS KT WITH (INDEX = UX_KeyTest);
SET STATISTICS IO OFF;
GO
SELECT
OBJECT_NAME(i.object_id) AS TableName,
i.name AS IndexName,
i.index_id AS IndexID,
SUM(a.total_pages) AS total_pages,
SUM(a.used_pages) AS used_pages,
SUM(a.data_pages) AS data_pages,
8 * SUM(a.used_pages) AS 'Indexsize(KB)'
FROM
sys.indexes AS i
JOIN sys.partitions AS p
ON p.object_id = i.object_id AND
p.index_id = i.index_id
JOIN sys.allocation_units AS a
ON a.container_id = p.partition_id
WHERE
i.object_id = OBJECT_ID('dbo.KeyTest', 'U')
GROUP BY
i.object_id,
i.index_id,
i.name
ORDER BY
OBJECT_NAME(i.object_id),
i.index_id;
GO
CREATE UNIQUE CLUSTERED INDEX CX_KeyTest ON dbo.KeyTest(ID) WITH DROP_EXISTING;
GO
ALTER INDEX UX_KeyTest ON dbo.KeyTest DISABLE;
GO
SET STATISTICS IO ON;
SELECT
KT.ID
FROM
dbo.KeyTest AS KT;
SELECT
*
FROM
dbo.KeyTest AS KT;
SET STATISTICS IO OFF;
GO
SELECT
OBJECT_NAME(i.object_id) AS TableName,
i.name AS IndexName,
i.index_id AS IndexID,
SUM(a.total_pages) AS total_pages,
SUM(a.used_pages) AS used_pages,
SUM(a.data_pages) AS data_pages,
8 * SUM(a.used_pages) AS 'Indexsize(KB)'
FROM
sys.indexes AS i
JOIN sys.partitions AS p
ON p.object_id = i.object_id AND
p.index_id = i.index_id
JOIN sys.allocation_units AS a
ON a.container_id = p.partition_id
WHERE
i.object_id = OBJECT_ID('dbo.KeyTest', 'U')
GROUP BY
i.object_id,
i.index_id,
i.name
ORDER BY
OBJECT_NAME(i.object_id),
i.index_id;
GO
To summarize, if just returning the key column, the non-clustered index does fewer reads, but as soon as you add the second column, if the non-clustered index is used it requires more reads due to the Bookmark/Key lookup. You also have to take into account the maintenance that having both indexes adds to inserts/updates/deletes. That's why I like using either Jason Strate's index analysis script[/url] or Brent Ozar Unlimited's sp_BlitxIndex both of which do some calculations to show the costs of indexes.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question