Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cluster, non-cluster index, pk, unique...

Posted on 2014-12-21
2
Medium Priority
?
108 Views
Last Modified: 2014-12-31
At 7:11 min. into this video, at the screenshot below, the explanation is about having cluster, non-cluster index, pk, unique:

https://www.youtube.com/watch?v=ITcOiLSfVJQ

Question: Could you please expand on this discussion and also explain why database safety issue raised here?

index
0
Comment
Question by:Mike Eghtebas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Assisted Solution

by:ste5an
ste5an earned 600 total points
ID: 40512026
Imho "saftey" refers to carelessness when creating indices. So a primary key is per default a clustered index in shortened syntax.

See Heaps.
In most cases it's better to have a clustered index on the primary key, cause when it's used in foreign key relations it may avoid additional sorting.

But that's just a guess.
0
 
LVL 52

Accepted Solution

by:
Vitor Montalvão earned 1400 total points
ID: 40513005
Only if safety means a way to guarantee the uniqueness of a row (no duplicate rows).
The examples shows the different ways to do that, either using PK (always Unique but can be Clustered or non-clustered) or creating indexes with Unique Constraints (can be also Clustered or non-clustered).
Remember that you can only have one clustered index by table because it's the index that says how your records will be physically ordered.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question