Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Table has no natural primary key and no clustered index Expand / Collapse
Author
Message
Posted Thursday, December 20, 2012 7:30 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 3:18 AM
Points: 590, Visits: 1,583
Hi all

I am wondering what is best practice when a table has no natural primary key and no clustered index, what is the best thing to do in regards to putting a clustered index on it.

I have a query that runs against the table which the execution plan has recommended a non-clustered index, but should this not be a clustered index instead?

Thanks
Post #1398969
Posted Thursday, December 20, 2012 9:38 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Monday, July 7, 2014 1:06 PM
Points: 1,478, Visits: 1,025
The answer is almost always "Depends"

Here's a good read.
http://www.sqlskills.com/blogs/kimberly/post/the-clustered-index-debate-continues.aspx
Post #1399035
Posted Thursday, December 20, 2012 9:56 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, July 4, 2014 3:55 AM
Points: 2,836, Visits: 5,062
Kwisatz78 (12/20/2012)
Hi all

I am wondering what is best practice when a table has no natural primary key and no clustered index, what is the best thing to do in regards to putting a clustered index on it.

I have a query that runs against the table which the execution plan has recommended a non-clustered index, but should this not be a clustered index instead?

Thanks


From details you gave, I can only give very generic idea: Add identity column and create unique clustered index on it.
With more details provided you are likely to get more relevant advice.

What kind of data your table is for? Transactional?
Which column do you use in filters when you query this table (most commonly)?
What kind of filter do you apply?
Do you join this table to another one? Which column?


_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1399038
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse