Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
T-SQL
»
Clustered Index
Clustered Index
Rate Topic
Display Mode
Topic Options
Author
Message
maxyogesh2002
maxyogesh2002
Posted Saturday, July 18, 2009 10:03 AM
SSC Rookie
Group: General Forum Members
Last Login: Monday, July 26, 2010 12:59 AM
Points: 42,
Visits: 108
Dear Friends
Is this true that Update SQL Query is slower because of Clustered index??????
currently i have cluster index on ID columns which have the primary key
How can i indentify the which column should have the Clustered index???
below i m attached my table defination...
Post Attachments
table_def.txt
(
27 views,
3.50 KB
)
Post #755310
GilaMonster
GilaMonster
Posted Saturday, July 18, 2009 10:42 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:07 PM
Points: 37,687,
Visits: 29,946
maxyogesh2002 (7/18/2009)
Is this true that Update SQL Query is slower because of Clustered index??????
Unlikely. Nonclustered indexes may slow a data modification down, because the change has to be made in multiple places, but that shouldn't be true of a clustered index because it's not a second copy of the data
currently i have cluster index on ID columns which have the primary key
How can i indentify the which column should have the Clustered index???
An identity's usually a fairly good choice for a cluster. It's narrow, unique and can't be changed plus the values for new rows are always higher than old, reducing fragmentation. I can't say if there's a better choice without knowing something about the data and how the table is used.
Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild
: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter
We stand on the bridge and no one may pass
Post #755317
maxyogesh2002
maxyogesh2002
Posted Saturday, July 18, 2009 10:48 AM
SSC Rookie
Group: General Forum Members
Last Login: Monday, July 26, 2010 12:59 AM
Points: 42,
Visits: 108
i m attached the my table defined above...
Post #755319
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Saturday, July 18, 2009 10:52 AM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 6:14 PM
Points: 31,421,
Visits: 13,734
The decision on what to make a clustered index is more based on the queries made against the table, not the definition. You would want those queries that look for a range of values, usually a date or other range to be considered. Typically I haven't picked the identity as the CI, but that's because I often have a better candidate, not because it's bad.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #755320
Jeff Moden
Jeff Moden
Posted Saturday, July 18, 2009 12:18 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 9:57 PM
Points: 32,906,
Visits: 26,790
First of all, that table is setup for CDR's (Call Detail Records). Rather I should say it's set up incorrectly for CDR's. Almost all of the columns are setup for VARCHAR(255) and the world of code is going to crawl because of all the implicit and explicit conversions you will need to make to rate, bill, and invoice the CDR's. Step 1 should be to assign the correct datatypes for each column.
Second... How often will you be inserting rows that are out of date order compared to what's at the "end" of the table? If it's a lot and your CI is on the date, you will get a lot of page splits. If it's a lot and your CI in on the autonumbering column, then you're inserts will be fine but your SELECT's may suffer a bit. It's a tradeoff depending on what the table will be used the most for... Inserts or Selects.
Are you going to use the contents of this table for rating and billing or are you just capturing CDR's for long term audits? And what's the source of information for this table? If it's coming directly from one or more switches as the calls occur, then you will definitely want the CI either on the IDENTITY column or on the call date time column.
No matter what, you really should fix the datatypes as previously stated.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #755337
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.