Download presentation
Presentation is loading. Please wait.
Published bySudirman Agusalim Modified over 5 years ago
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 | 4/3/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 | 4/3/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 | 4/3/2019 | Sliding Window Table Partition Intro
5
What is partitioning? Enterprise Edition only First Available in 2005
5 | 4/3/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 | 4/3/2019 | Sliding Window Table Partition Intro
7
What is partitioning? Before partitioned example 7 | 4/3/2019 |
7 | 4/3/2019 | Sliding Window Table Partition Intro
8
What is partitioning? After partitioning example 8 | 4/3/2019 |
8 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/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 | 4/3/2019 | Sliding Window Table Partition Intro
21
Demonstration 4/3/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 | 4/3/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 | 4/3/2019 | Sliding Window Table Partition Intro
24
Questions? Thank you 4/3/2019 | Sliding Window Table Partition Intro
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.