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 2012 Forums
 Transact-SQL (2012)
 TSQL Question

Author  Topic 

tooba
Posting Yak Master

224 Posts

Posted - 2014-07-16 : 00:04:08
Quick question,

I have TableA

ID, CASEID,AccountNumber,Fname,Lname,City

This table has Millions of rows, any my ID is a Primary Key (Clustered Index)

Now I am thinking to change Primary Key to (ID,CASEID,AccountNumber). I have two question here

1) After I change Primary Key, it could possible any performance issue?
2) This table has haviely Insert and Update, is it will effect?

Thank You.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-07-16 : 04:04:07
The primary key is just a constraint. It will somewhat affect performance because SQL Server will need to enforce the contraint.
The clustered key is still ID column?


Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

tooba111
Starting Member

22 Posts

Posted - 2014-07-16 : 12:13:00
Before it was just ID, Now i am thinking to use Composite key (ID,CASEID,AccountNumber) as a Primary Key (Clustered Index).

and my question is above post...

Please let me know, if my ans/question is still not clear.

Thank You.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2014-07-16 : 14:19:02
You are going to change the clustered key too?



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-07-16 : 16:43:55
quote:
Originally posted by SwePeso

You are going to change the clustered key too?

Apparently that is the plan.

quote:
Originally posted by tooba111

Before it was just ID, Now i am thinking to use Composite key (ID,CASEID,AccountNumber) as a Primary Key (Clustered Index).

Go to Top of Page

tooba111
Starting Member

22 Posts

Posted - 2014-07-17 : 12:41:52
Yes.
Go to Top of Page

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-07-17 : 19:25:01
By making your clustered key wider, you will be impacting your indexing performance. How much this will be noticeable will need to be determined: Guess and Test.



Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy
Go to Top of Page

tooba
Posting Yak Master

224 Posts

Posted - 2014-07-18 : 01:12:07
Thank You for your reply, Would You mind if I ask Why it will effect performance issue?
Go to Top of Page
   

- Advertisement -