+ All Categories
Home > Education > Table Partitioning: Secret Weapon for Big Data Problems

Table Partitioning: Secret Weapon for Big Data Problems

Date post: 30-Nov-2014
Category:
Upload: john-sterrett
View: 721 times
Download: 1 times
Share this document with a friend
Description:
 
46
October 15-18, 2013 Charlotte, NC Table Partitioning: Secret Weapon for Big Data Problems John Sterrett, Sr. Database Admin Advisor DELL
Transcript
Page 1: Table Partitioning: Secret Weapon for Big Data Problems

October 15-18, 2013 Charlotte, NC

Table Partitioning: Secret Weapon for Big Data Problems

John Sterrett, Sr. Database Admin Advisor DELL

Page 2: Table Partitioning: Secret Weapon for Big Data Problems

About John

2

Page 3: Table Partitioning: Secret Weapon for Big Data Problems

How to contact me?

3

http://johnsterrett.com/go/partition

Blog: http://JohnSterrett.com/ Twitter: @JohnSterrett LinkedIn: http://linkedin.com/in/johnsterrett

Page 4: Table Partitioning: Secret Weapon for Big Data Problems

4

Agenda

Big Data starting to slow you down? Data growth putting your maintenance tasks in danger of not meeting your SLAs? Wish you could archive old data with minimal impact to your tables during the archive process or that you could eliminate most of the data in your tables when you query them? If so, it’s time you consider implementing table partitioning to help with general performance and reduce your window for completing maintenance tasks. •  Learn if Partitioning can help you manage big data. •  Understand how partitioning works. •  Learn how to maintain table partitioning with an automated

sliding window.

Page 5: Table Partitioning: Secret Weapon for Big Data Problems

Assumptions…

5

•  You are not familiar with Table Partitioning and want to see how it works.

•  You have Enterprise Edition •  Highly Transactional Tables with over 50 GB of data •  General Maintenance Tasks are in danger of not meeting

your SLA •  Purge and/or Archive process is slowing you down.

Page 6: Table Partitioning: Secret Weapon for Big Data Problems

The Big Question…

6

HOW CAN TABLE PARTITIONG MAKE MY LIFE EASIER?

Page 7: Table Partitioning: Secret Weapon for Big Data Problems

How partitioning helps me?

7

•  Reduce Maintenance Tasks

Page 8: Table Partitioning: Secret Weapon for Big Data Problems

How partitioning helps me?

8

•  Reduce Maintenance Tasks •  Improves Purging and/or Archiving

Page 9: Table Partitioning: Secret Weapon for Big Data Problems

How partitioning helps me?

9

•  Reduce Maintenance Tasks •  Improves Purging and/or Archiving •  Improves Performance

Page 10: Table Partitioning: Secret Weapon for Big Data Problems

Big Question…

10

HOW DOES TABLE PARTITIONING WORK?

Page 11: Table Partitioning: Secret Weapon for Big Data Problems

High Level…

11

Page 12: Table Partitioning: Secret Weapon for Big Data Problems

High Level…

12

Partition  Table

Partition  Scheme

Partition  Function

Page 13: Table Partitioning: Secret Weapon for Big Data Problems

Selecting The Partition Column

13

Only get one column, use it wisely! Column should be a highly used filter. •  Review index usage statistics •  Review Missing index statistics •  Review Queries and Talk to developers ;-)

Column must be part of clustered index

Page 14: Table Partitioning: Secret Weapon for Big Data Problems

Partition Function

14

Defines the data type used to distribute data into partitions. Assigns boundary values to split data between partitions. Assigns the RANGE for boundary values Partitions = Boundary values + 1 NULL values go to left most partition

Page 15: Table Partitioning: Secret Weapon for Big Data Problems

Partition Function

15

Partition functions are not static. They can change over time with SPLIT and MERGE statements. Range LEFT is used by default.

Page 16: Table Partitioning: Secret Weapon for Big Data Problems

Partition Function - Range

16

{min….100}, {101…200}, {201...300}, {301…max} {min…99}, {100…199}, {200…299}, {300…max}

Page 17: Table Partitioning: Secret Weapon for Big Data Problems

Partition Scheme

17

Assigns a partition function to a partition scheme Assigns filegroups to partitions

Page 18: Table Partitioning: Secret Weapon for Big Data Problems

October 15-18, 2013 | Charlotte, NC

Partitioning DEMO

Page 19: Table Partitioning: Secret Weapon for Big Data Problems

Big Question…

19

HOW DOES TABLE PARTITIONING IMPROVE MY MAINTENANCE TASKS?

Page 20: Table Partitioning: Secret Weapon for Big Data Problems

Improving Maintenance Tasks

20

Backup and restore filegroups based on business priorities. Index Maintenance by partition New Features in SQL 2014 •  Rebuild index online by partition •  Incremental Statistics by partition (SQL 2014 CTP 2)

Page 21: Table Partitioning: Secret Weapon for Big Data Problems

Incremental Statistics

21

Just added in SQL Server 2014 CTP2 From Books Online: “When ON, the statistics are recreated as per partition statistics.” Cannot be used for the following: •  Statistics created with indexes that are not partition-

aligned with the base table •  Filtered Indexes

Page 22: Table Partitioning: Secret Weapon for Big Data Problems

22

HOW DOES TABLE PARTITIONING IMPROVE PERFORMANCE?

Page 23: Table Partitioning: Secret Weapon for Big Data Problems

Partition Elimination

23

Page 24: Table Partitioning: Secret Weapon for Big Data Problems

Skip-Scan: Seek keys

24

Page 25: Table Partitioning: Secret Weapon for Big Data Problems

Database Compression by Partition

25

Page 26: Table Partitioning: Secret Weapon for Big Data Problems

October 15-18, 2013 | Charlotte, NC

Partitioning DEMO

Page 27: Table Partitioning: Secret Weapon for Big Data Problems

27

HOW DOES PARTITIONING IMPROVE ARCHIVING AND PURGING?

Page 28: Table Partitioning: Secret Weapon for Big Data Problems

Real World Example:

28

Page 29: Table Partitioning: Secret Weapon for Big Data Problems

Quickest way to move billions of rows

29

Meta data swap is quickest way to move billions of rows assuming you can get a schema lock.

Page 30: Table Partitioning: Secret Weapon for Big Data Problems

Sliding Window Goals

30

SPLIT and MERGE with empty partitions Use SWITCH to do meta-data swaps Minimize all physical data movement

Page 31: Table Partitioning: Secret Weapon for Big Data Problems

Range Right - MERGE

31

Page 32: Table Partitioning: Secret Weapon for Big Data Problems

Range Left - MERGE

32

Page 33: Table Partitioning: Secret Weapon for Big Data Problems

Range Right - SPLIT

33

Page 34: Table Partitioning: Secret Weapon for Big Data Problems

Range Left - SPLIT

34

Page 35: Table Partitioning: Secret Weapon for Big Data Problems

Visual Sliding Window Example

35

Page 36: Table Partitioning: Secret Weapon for Big Data Problems

FG1 FG2 FG3 FG4 FG5

Partiton1(EMPTY)

Partiton2(DATA)

Partiton3(DATA)

Partiton4(DATA)

Partiton5(DATA)

Visual Sliding Window Example

Page 37: Table Partitioning: Secret Weapon for Big Data Problems

FG1 FG3 FG4 FG5

Partiton1(EMPTY)

Partiton3(DATA)

Partiton4(DATA)

Partiton5(DATA)

FG2

Staging  Table    

(EMPTY)

Partiton2(DATA)

Visual Sliding Window Example

Page 38: Table Partitioning: Secret Weapon for Big Data Problems

FG2

Staging  Table    (DATA)

Partiton2(EMPTY)

SWAP FG3 FG4 FG5

Partiton3(DATA)

Partiton4(DATA)

Partiton5(DATA)

FG1

Partiton1(EMPTY)

Visual Sliding Window Example

Page 39: Table Partitioning: Secret Weapon for Big Data Problems

FG2

Staging  Table    (DATA)

Partiton2(EMPTY)MERGE

FG3 FG4 FG5

Partiton3(DATA)

Partiton4(DATA)

Partiton5(DATA)

FG1

Partiton1(EMPTY)

Visual Sliding Window Example

Page 40: Table Partitioning: Secret Weapon for Big Data Problems

FG3 FG4 FG5

Partiton2(DATA)

Partiton3(DATA)

Partiton4(DATA)

FG1

Partiton1(EMPTY)

FG2

Staging  Table    (DATA)

Visual Sliding Window Example

Page 41: Table Partitioning: Secret Weapon for Big Data Problems

FG3 FG4 FG5

Partiton2(DATA)

Partiton3(DATA)

Partiton4(DATA)

FG1

Partiton1(EMPTY)

FG2

Staging  Table    

(EMPTY)

NEXT  USED

Visual Sliding Window Example

Page 42: Table Partitioning: Secret Weapon for Big Data Problems

FG3 FG4 FG5

Partiton2(DATA)

Partiton3(DATA)

Partiton4(DATA)

FG1

Partiton1(EMPTY)

FG2

Partiton5(DATA)

Visual Sliding Window Example

Page 43: Table Partitioning: Secret Weapon for Big Data Problems

Sliding Window Steps...

43

Create partition swap table (if it doesn’t exist) 1.  Insert partition swap meta data 2. Create staging table 3. Meta-data swap (partition 2 with staging table) 4. Merge Partitions #1 and #2 5. Mark next used partition 6. Split to create new partition 7. Update processed partition swap meta data.

Page 44: Table Partitioning: Secret Weapon for Big Data Problems

October 15-18, 2013 | Charlotte, NC

Partitioning DEMO

Page 45: Table Partitioning: Secret Weapon for Big Data Problems

Questions…

45

http://johnsterrett.com/go/partition

Blog: http://JohnSterrett.com/ Twitter: @JohnSterrett LinkedIn: http://linkedin.com/in/johnsterrett

Page 46: Table Partitioning: Secret Weapon for Big Data Problems

October 15-18, 2013 | Charlotte, NC

Thank you for attending this session and the 2013 PASS Summit in Charlotte, NC

46


Recommended