Solved

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

Posted on 2014-12-21
2
102 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 33

Assisted Solution

by:ste5an
ste5an earned 150 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 49

Accepted Solution

by:
Vitor Montalvão earned 350 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

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

749 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