Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Where to use indexes (clustered)

Author  Topic 

envida
Starting Member

6 Posts

Posted - 2003-08-18 : 09:30:15
I have a couple of questions about indexes...

I have a "uniqueidentifier" column in my database. Is it best to use a clustered index or a normal index on this column? Are there any advanteges on using a index on this column?

Is it better to have a index for each column where I need one or should a make one index with all the columns I want to index?

I have 2 columns in a table that are unique. Is it more sensible too create a clustered index with both or just use 1 column as primary key and use a unique index on the other one?

Hope someone got some input on this.

cheers

mr_mist
Grunnio

1870 Posts

Posted - 2003-08-18 : 09:36:26
Experiment to see which gives you the best results with your queries...

If you're doing a lot of updates, you might not want to have so many indexes.

If you have a wide index, and the column being used is not the first one in the index, then you will see index scans instead of seeks, which may be slower.

-------
Moo. :)
Go to Top of Page

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2003-08-18 : 10:31:13
A lot of the questions depends on the extent of your knowledge on the transactions that are running against the table.

It is UNLIKELY that indexing every column would be a good idea, as any insert, update or delete statement would incur overheads.

Consider clustering on the column you most use for access. For example, if you have 5 transactions (or statements) that are going to run against that table :
Q1, Q2, Q3, Q4 and Q5. If you know that Q2 run 50000 times a day, and none of the others run anywhere near that frequency, then it would likely be best of try and cluster to help access for Q2. Q2 would be your "critical transaction".

[note that Critical transactions are not always on selected on frequency per day. For example, if a certain transaction has very tight, specific SLA requirements, you may choose to tune based on that ]

At the end of the day, your specific environment will drive your requirements. Your must valuable inputs would be :
Transactional Analysis ;
Volumetrics (Data volumetrics, transactional volumetrics) ;
ER Model ;

Good luck

*#&#* *#&#* *#&#* *#&#*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page
   

- Advertisement -