Table Partitions Flashcards

1
Q

How is data partitioned in a table?

A

On a single column often called the Partition Key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Does the Partition Key column have to be a single column or can it be multiple?

A

It has to be a single column, but you CAN use a Computed Column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the best column to use when selecting the Partition Key?

A

A column that is almost always used as a filter in queries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why is using the Partition Key in a filter beneficial?

A

SQL Server will access only the relevant partitions - called Partition Elimination and can greatly improve performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the two ranges that a partition function can be created with?

A

Range Left and Range Right

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does Range Left mean?

A

The actual boundary value belongs to its left partition. It is the LAST VALUE IN THE LEFT PARTITION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does Range Right mean?

A

The actual boundary value belongs to its right partition, it is the FIRST VALUE IN THE RIGHT PARTITION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Can you have both a range left AND a range right in a partition function?

A

No

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a partition scheme?

A

This is what maps the logical partitions to physical filegroups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a filegroup?

A

It’s a container of 1 or more files that can be stored on one or more disks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a major benefit with filegroups with regard to data integrity?

A

You can set filegroups to READ ONLY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a space benefit regarding a READ ONLY filegroup?

A

You can backup and restore filegroups separately, so you could take a single backup of the READ ONLY filegroup and store it away, saving space on your backups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can you ensure that updates on one partition do not cause blocking on other partitions?

A

ALTER TABLE [TABLENAME] SET LOCK_ESCALATION = auto

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the lock_escalation settings for a table?

A

Auto
Table
Disable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is Lock_Escalation = Auto?

A

If the table is partitioned, it will lock to the partition

If the table is not partitioned, it will lock to the Table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Lock_Escalation = Table?

A

Lock escalation is done at table-level granularity whether the table is partitioned or not (Default)

17
Q

What is Lock_Escalation = Disable?

A

Prevents lock escalation in cases outside of SERIALIZABLE

18
Q

How can you quickly move data from one partitioned table to another table to another without locking records at all?

A

Using ALTER TABLE SWITCH TO TABLE2

19
Q

When you use the SWITCH command, what are all of the things you have to verify on the second table?

A
    • The source and target tables (or partitions) must have identical columns, indexes and use the same partition column
    • The source and target tables (or partitions) must exist on the same filegroup
    • The target table (or partition) must be empty