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 September 28th, 2004, 07:59 AM
Registered User
 
Join Date: Sep 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default indexing

how to create cluster indexing in the particular col of the table
will it be fast


 
Old September 28th, 2004, 08:31 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Here is the sample query to create a clustered index on a table. Please substitute things in < and >.

CREATE CLUSTERED INDEX [<index name>] ON [<owner>].[<tablename>]([field1], [field2], ....) WITH FILLFACTOR = <required fill factor> ON [PRIMARY]

Creating a clustered index will help fetch records fast. But there will be a slight increase in time when inserting a new record and when updating any indexed fields.
 
Old September 28th, 2004, 11:49 PM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Anantsharma Send a message via Yahoo to Anantsharma
Default

HI,

Well if u define the Colum as Primery Key, It will create Clustered Index by default. If the colum is not Primery key, then its better create Non clustered Index on that with fill factor between 65 - 80.

You can create clustered index using Index Wizard in Enterprise Manager (Tools -->> Wizards ) also.

Creating clustered index slows down Insert,Update and Delete actions but no doubt improves read speed as the data is already in sorted mode and so SQL doesn't have to go to TempDB. Howevre If your table has a Primary Key colum, then u can't create clustered index on that table on other colum. If its a must case, then U have to drop the Clustered Index related to Primary key Colum and then only u can create clustered index on other colum.

***********
CREATE CLUSTERED INDEX IND_CL_COL1 ON TABLE1 (COL1 ACS)
WITH FILL FACTOR =75
***********

**IND_CL_COL1 is name of index
** FILL Factor may vary a little.

Thanks

B. Anant





Similar Threads
Thread Thread Starter Forum Replies Last Post
CANNOT APPLY INDEXING WITH [] pallone .NET Framework 2.0 7 April 8th, 2008 06:40 AM
Class Indexing ~Bean~ ASP.NET 1.x and 2.0 Application Design 2 August 16th, 2005 06:28 AM
indexing within grouping jkmyoung XSLT 3 November 15th, 2004 04:08 PM
Indexing. kilika SQL Server 2000 3 May 24th, 2004 03:14 PM





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