Solved

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

Posted on 2014-12-21
2
101 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
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 48

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

837 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