Presentation is loading. Please wait.

Presentation is loading. Please wait.

Table Partitioning Intro and make that a sliding window too!

Similar presentations


Presentation on theme: "Table Partitioning Intro and make that a sliding window too!"— Presentation transcript:

1 Table Partitioning Intro and make that a sliding window too!
Using SQL Server

2 About Me Jeff Reinhard 20+ years database development experience
@SQLMajor Employment Highlights: Ernst & Young Internet Security Systems/IBM AirWatch WebMD CheckFree 2 | 2/22/2019 | Sliding Window Table Partition Intro

3 Agenda What is Partitioning? Why use Partitioning? The 4 main steps
The Sliding window Add new partitions (switching in) Switch Out old partition Demo to see the magic 3 | 2/22/2019 | Sliding Window Table Partition Intro

4 Agenda What is Partitioning? Why use Partitioning? The 4 main steps
The Sliding window Add new partitions (switching in) Switch Out old partition Demo to see the magic 4 | 2/22/2019 | Sliding Window Table Partition Intro

5 What is partitioning? Enterprise Edition only First Available in 2005
5 | 2/22/2019 | Sliding Window Table Partition Intro

6 What is partitioning? The data in partitioned tables and indexes are horizontally divided into units that can be spread across more than one filegroup in a database. Aligns the data in the clustered and non-clustered indexes with the partition key. 6 | 2/22/2019 | Sliding Window Table Partition Intro

7 What is partitioning? Before partitioned example 7 | 2/22/2019 |
7 | 2/22/2019 | Sliding Window Table Partition Intro

8 What is partitioning? After partitioning example 8 | 2/22/2019 |
8 | 2/22/2019 | Sliding Window Table Partition Intro

9 Agenda What is Partitioning? Why use Partitioning? The 4 main steps
The Sliding window Add new partitions (switching in) Switch Out old partition Demo to see the magic 9 | 2/22/2019 | Sliding Window Table Partition Intro

10 Why Partition? Improved read performance
Loading large amounts of data in batch Easier and faster archiving and purging Partitioning can make large tables and indexes more manageable and scalable Partition elimination and aligned indexes Load into separate table then switch into partitioned table Switching partitions out and switching into other table By having smaller structures 10 | 2/22/2019 | Sliding Window Table Partition Intro

11 Agenda What is Partitioning? Why use Partitioning The 4 main steps
The Sliding window Add new partitions (switching in) Switch Out old partition Demo to see the magic 11 | 2/22/2019 | Sliding Window Table Partition Intro

12 The Four main steps - Overview
Create a filegroup or filegroups Create a partition function Create a partition scheme Create or modify a table or index and specify the partition scheme as the storage location. 12 | 2/22/2019 | Sliding Window Table Partition Intro

13 Step 1: File Groups Static file groups can require less frequent backups Can put some on slower storage, others on faster May need to honor space restrictions of drive sizes for SAN, OS or backups Sliding partitions and staging tables must be on same file group 13 | 2/22/2019 | Sliding Window Table Partition Intro

14 Step 2: Function Uses the 1 column chosen to be the key
Defines ranges and boundaries to separate data Uses specific values It can be dynamic and change over time, adding new partitions 14 | 2/22/2019 | Sliding Window Table Partition Intro

15 Step 2: Function example
CREATE PARTITION FUNCTION [pfSample](datetime) AS RANGE LEFT FOR VALUES (1, 100, 1000); A function must cover all data: from minus infinity to infinity. 15 | 2/22/2019 | Sliding Window Table Partition Intro

16 Step 3: Scheme Maps functions to file groups
Can do one partition per file group Can map multiple partitions to each file group Can map all partitions to the same file group 16 | 2/22/2019 | Sliding Window Table Partition Intro

17 Step 4: Set scheme as storage
Drop all indexes Alter table using scheme This moves the data into the partition Add back clustered and non clustered indexes using scheme (to align) 17 | 2/22/2019 | Sliding Window Table Partition Intro

18 Agenda What is Partitioning? Why use Partitioning The 4 main steps
The Sliding window Add new partitions (switching in) Switch Out old partition Demo to see the magic 18 | 2/22/2019 | Sliding Window Table Partition Intro

19 Sliding Window Good use case is for date ranges of data to keep online
Add new date partitions in Switch out old partitions to archive or purge 19 | 2/22/2019 | Sliding Window Table Partition Intro

20 Agenda What is Partitioning? Why use Partitioning The 4 main steps
The Sliding window Add new partitions (switching in) Switch Out old partition Demo to see the magic 20 | 2/22/2019 | Sliding Window Table Partition Intro

21 Demonstration 2/22/2019 | Sliding Window Table Partition Intro

22 Demo Review We picked a table and strategy Did the 4 step shuffle
File Group and File Create partition function Create partition scheme Set scheme as storage The Rolling window Add new partitions Switch out old partition 22 | 2/22/2019 | Sliding Window Table Partition Intro

23 Resources Best Practices Partitioning Concepts CodePlex
CodePlex Tool to help manage and script sliding window partitioning Best Practices 23 | 2/22/2019 | Sliding Window Table Partition Intro

24 Questions? Thank you 2/22/2019 | Sliding Window Table Partition Intro


Download ppt "Table Partitioning Intro and make that a sliding window too!"

Similar presentations


Ads by Google