Aspet Golestanian Namagerdi (5/2/2013)
We are using Sql Server 2008 and we have a log table which has one clustered index(on creationdate, that can be duplicate) and two non clustered index.This table is being used for logging and being inserted and updated frequently.Is it neccessary to create a primary key(new identity column) on this table?and if we do not create any,will that cause any problem?
No, it's not essential to have a PK but very beneficial. And for a log table, it should be on the CreationDate and an IDENTITY column AND it should be the clustered index. That way the table has very little chance of becoming fragmented and your clustered index will be UNIQUE which will cause great benefit for any index because the clustered index becomes a part of every non-clustered index.
As a sidebar, you're saying this table is being usef for logging. Why then would this table ever be made to suffer and UPDATE? Logs are logs and should never see an UPDATE ever.
is pronounced ree-bar and is a Modenism for R
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Helpful Links:
How to post code problemsHow to post performance problemsForum FAQs