SQL Clone
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
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2601 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
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4841 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
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11772 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