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 November 15th, 2004, 07:18 AM
Authorized User
 
Join Date: Nov 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

will non clust index requires space in sql server
will it increase the size of database
if yes than how much %
thanks

 
Old November 15th, 2004, 07:23 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

the table is ordered physically in the order of the Clustered index. Therefore, there can be only one clustered index in a table. However, there can be multiple Non Clustered indices in a table. These indeces are maintained as B-Trees by SQL Server. Therefore, Navigation to the nodes of the tree is faster than when no index is specified. This is not going to increase the size of the database.

If you have more indeces in a table, the searching is going to be faster.

Regards
Ganesh
 
Old November 15th, 2004, 07:30 AM
Authorized User
 
Join Date: Nov 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

please write the statement for creating the nonclust index on the multiple column
are u sure it will not increase the size of the database then where it store the logical table to map with the physical rows of the table
thanks


 
Old November 15th, 2004, 07:44 AM
Authorized User
 
Join Date: Nov 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Create nonclustered indexes to increase performance of the queries that return few rows and where the index has good selectivity.
In comparison with a clustered index, which can be only one for each table, each table can have as many as 249 nonclustered indexes. However, you should consider nonclustered index creation as carefully as the clustered index, because each index take up disk space and drag on data modification.


 
Old November 16th, 2004, 01:41 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Non-Clustered Index does not physically order the data pages in the disk so the memory required for creating a non-clustered Index is very less. The SQL Server maintains the indeces as B-Trees. In a clustered index, the leaf contains the actual data pages of the table and the data is physically stored in the logical order of the index.

A nonclustered index is analogous to an index in a textbook. The data is stored in one place, the index in another, with pointers to the storage location of the data. The items in the index are stored in the order of the index key values, but the information in the table is stored in a different order (which can be dictated by a clustered index). If no clustered index is created on the table, the rows are not guaranteed to be in any particular order.



You can get more information from this link.
http://msdn.microsoft.com/library/de...es_02_2248.asp

Clustered Indeces are suitable in the following cases
   Columns used in range queries
   Columns used in order by or group by queries
   Columns used in table joins
   Queries returning large result sets

Non-Clustered Indeces are suitable in the following cases
   Columns used in aggregate functions
   Foreign keys
   Queries returning small result sets.l

Regards
Ganesh
 
Old November 16th, 2004, 01:46 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

I dont think it is necessary to consider the space occupied by indeces because disk space is very cheap these days. You have to consider only the time taken to access the data. Indices will definelty help you in improving your response time. If your table is expecting only updates and inserts, it is best to have only a clustered index and that should be ideally in the primary key column.

If you table is not expcting any updates but expects only selects, then ideally you can have non-clusterd indeces on each column which are involved in the where clause.

Regards
Ganesh
 
Old November 16th, 2004, 02:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I would suggest you go through the online documentation / books online for indexing. It is not that creating more indices increase the performance. It depends on the data that gets stored in that column too. IMO too many indices/ index on unwanted columns is going to affect the performance. For eg: Index on a column that contains gender(male/female) is not going to help you and is unnecesary to create index on that. Same way for a TRUE/FALSE column. So it depends on the implication of data too. One cannot blindly index all the columns on a table expecting it to have good performance. Too much of anything is good for nothing.

Also make a search on this forum for index, there were many such discussion on this topic and jeff's posts on those thread should put on the right track.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old November 16th, 2004, 02:15 AM
Authorized User
 
Join Date: Nov 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks
let me implement this
then let u know if it works or not


 
Old November 22nd, 2004, 04:56 AM
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,

You can go with Non Clustered index without worrying about space or performance. Here is an Example I use in one of my databases.

My database Name is TRPRO_MANMAN
Table Name is PGLMAS. Colum is PGLNUM. And Yes Its not a Primery Key.

    CREATE NONCLUSTERED INDEX IND_PGLNUM_NCL
    ON PGLMAS (PGLNUM)
    WITH FILLFACTOR = 70

--IND_PGLNUM_NCL is name of Index which will be refered by SQL
--PGLMAS IS table, PGLNUM is colum name.NON PK.

Primery key is not a necessity to inprove performance in search queries. I alsways choose Non Clustered Index.

Blindly speaking, you should create this type of Non Clustered Index for every colum you use for searching. You don't have to worry about Primery Keys.

Hope you got my point.

B. Anant





Similar Threads
Thread Thread Starter Forum Replies Last Post
New text search doesn't preselect search string planoie Visual Studio 2005 0 July 23rd, 2007 06:47 AM
SQLserver 2000 vs SQLserver 2005 Express cJeffreywang BOOK: Beginning ASP.NET 2.0 and Databases 0 April 22nd, 2007 09:52 AM
File Search / Indexing Search with .net 2.0 maulik77 ASP.NET 1.0 and 1.1 Basics 2 March 15th, 2007 12:45 AM
Search Engine for Full-text Search Kala ASP.NET 1.0 and 1.1 Professional 2 August 29th, 2004 02:16 AM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM





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