Wrox Programmer Forums
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 31st, 2007, 09:29 AM
Authorized User
Join Date: Dec 2006
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Index


I have 20 columns in the table. Is it advisable to have 20 non clustered index or combination of non clustered index in the table.
When you have clustered index defined on a table, there is a possibility of rebuilding the INDEX whenever there is a DML Operation, but for non clustered there is absolutely no rebuilding.
Can i go with this approach or correct me if i'm wrong from performance perspective.


Old December 31st, 2007, 12:42 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post

Not to be flip here, but you should have as many indexes as you need, and no more. Indexes must be maintained whenever you add, delete, or update a row, so this overhead must be taken into account when creating an index.

There are several reasons why the query optimizer might use an index, such as selecting rows via a WHERE clause, for JOIN and UNION operations, and for ORDER BY operations, to name a few. There is no guarantee that the optimizer will in fact use a particular index just because it happens to exist. The theory is that it "knows better than you" what the situation is, and will decide which indexes to use (or not use) based on its evaluation of the optimum query plan.

So, you should create an index on a column (or set of columns) because you have identified situations where it will be used. Don't create one for lack of a better idea...

Jeff Mason

Similar Threads
Thread Thread Starter Forum Replies Last Post
z-index and ie7 fredzbooks BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 0 August 25th, 2007 07:44 AM
Index Server darkestangel1980 ASP.NET 1.0 and 1.1 Basics 0 August 18th, 2007 06:56 AM
generate index rshan XSLT 1 May 23rd, 2007 01:14 AM
Index question Gert SQL Server 2000 3 February 26th, 2004 05:26 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.