July 18, 2009 at 10:03 am
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...
July 18, 2009 at 10:42 am
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, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
July 18, 2009 at 10:48 am
i m attached the my table defined above...
July 18, 2009 at 10:52 am
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.
July 18, 2009 at 12:18 pm
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
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply