1 / 15

Partitioning Design

Partitioning Design. For Performance and Maintainability. Martin Cairns http://sqlbyparts.com http://twitter.com/MartinCairnsSQL. Who am I?. @MartinCairnsSQL. www.sqlbyparts.com. Partitioning Defined. Source: http://oxforddictionaries.com/definition/english/partition.

dolph
Download Presentation

Partitioning Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Partitioning Design For Performance and Maintainability Martin Cairns http://sqlbyparts.com http://twitter.com/MartinCairnsSQL

  2. Who am I? • @MartinCairnsSQL • www.sqlbyparts.com

  3. Partitioning Defined Source: http://oxforddictionaries.com/definition/english/partition Partitioning (noun) the action or state of dividing or being divided into parts a structure dividing a space into two parts

  4. Types of Partitioning • Horizontal • Partition Table by Rows • Vertical • Partition Table by Columns • File Group • Partition Tables by File Group

  5. Horizontal Partitioning Divides the rows into small sets by boundaries

  6. Vertical Partitioning Divides columns from one table into multiple tables

  7. File Group Partitioning File group partitioning is separating the storage of tables and indexes onto separate database files During a Primary File Group restore the whole database will be offline Separate the system & user tablesto allow the quickest restore time Since the partitioned database is made up of smaller parts it is easier to manage the storage location of the files

  8. Using Table Partitioning Supports Horizontal Partitioning Partition Function defines boundaries based on a single column Partition Scheme defines the File Group Inserts automatically supported All partitions share the same definition as the table (indexes, columns, fill factor etc)

  9. Table Level Limitations Only ~200 steps for each statistics across the whole table Online Index rebuilds are for the whole table not individual partitions Fill Factor Lock settings (Row, Page, Escalation, etc) Indexes are defined for the whole table rather than partitions

  10. Using View Partitioning View Partitioning allows you to overcome Table Level Constraints Check Constraints used to define partitions Combine all tables with a UNION ALL View Can be used together with Table Partitioning Trigger required to allow INSERT with Identity column Allows more complex partitioning schemes

  11. Candidates for Partitioning Large vs. Small Tables Replicated vs. Non-Replicated Tables Normal vs. BLOB columns Write Heavy Current data vs. Heavily Read Historic data Read \ Write vs. Read Only Tables

  12. Partial Database Availability Also referred to as Piecemeal Restore Full Recovery Model is Required Individual File & File Groups Restore Only the Primary File Group is required to restore a database Allows restoring a subset of a correctly partitioned database for quicker recovery from a disaster

  13. Tipping Point \ Why is it Table Scanning As the number of rows in a table increasethe depth of the B+Tree increases The number of Page Reads for a lookup is equal to the depth of the B+Tree The Tipping Point is the point where a Full Table Scan requires less Page Reads than the lookups

  14. What Does Partition Give Us • Choices • Using different Tiers of Storage • Allows quicker recovery strategies • Allows partial restores of the database • Performance • Allows reduction of overhead of backups • Allows better query plans due to more accurate statistics on large tables

  15. Demos Moving Tables to File Groups Partial Restore + Using Partial Restore to Initialise Replication Moving Partition Between Tables For Current vs. Historic Show how View Partitioning can present a single view of all tables & still support partition elimination

More Related