Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Table has no natural primary key and no clustered index


Table has no natural primary key and no clustered index

Author
Message
Kwisatz78
Kwisatz78
SSChasing Mays
SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)SSChasing Mays (607 reputation)

Group: General Forum Members
Points: 607 Visits: 1821
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
Ray M
Ray M
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1491 Visits: 1076
The answer is almost always "Depends"

Here's a good read.
http://www.sqlskills.com/blogs/kimberly/post/the-clustered-index-debate-continues.aspx
Eugene Elutin
Eugene Elutin
Hall of Fame
Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)Hall of Fame (3K reputation)

Group: General Forum Members
Points: 3042 Visits: 5478
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!":-D
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search