Upload
james-estrada
View
33
Download
1
Embed Size (px)
DESCRIPTION
Data Partitioning – SQL Server Satya. Agenda. Data Partitioning in SQL Server Architecture Demo. Data Partitioning. Also known as Horizontal Partitioning Large table/index can be split into multiple manageable portions Advantages Improves Query Performance - PowerPoint PPT Presentation
Citation preview
Data Partitioning – SQL Server
Satya
Agenda•Data Partitioning in SQL Server•Architecture•Demo
Data Partitioning
•Also known as Horizontal Partitioning▫Large table/index can be split into multiple
manageable portions•Advantages
▫Improves Query Performance▫Better Data Manageability and Cost Effective▫Deleting and Moving data is faster from
partitions▫Narrow downs the index maintenance window▫OLTP/DSS – Operational/Non-Operational data
P1
Index /Heap
Table/Indexed View
Pn
Index/Heap
Data pages Data pages
Logical Representation
Data Partitioning Architecture
Partition Concepts•PARTITION FUNCTION
▫Used to specify partition boundary values▫Two types (represents boundary data
directions) LEFT -myself and my left range values RIGHT -myself and my right range values
•PARTITION SCHEME▫Logical & Partitions physically aligned▫Span over single or multiple file groups▫Can specify each partition can go to a
individual file group or all partitions can go into a single file group
CREATE PARTITION FUNCTION MyPartitionFuncationName_pfn(int)AS RANGE RIGHT FOR VALUES(10,50)
CREATE PARTITION FUNCTION MyPartitionFuncationName_pfn(int)AS RANGE LEFT FOR VALUES(10,50)
Creating Partition Function
<=10 >10 & <=50
>50
<10 >=10 & <50
>=50
CREATE PARTITION SCHEME MyPartitionScheme_psAS PARTITION MyPartitionFuncationName_pfnALL TO ([FG]) --- specifying single file group--TO ([FGA], [FGB]) --- specifying multiple file groups
Partition Physical Architecture
Database File Group A
File Group B
File Group C
File Group D
Partition scheme
DatabaseFile GroupPartition
scheme
Partition Concepts (2)•SPLIT/MERGE
▫SPLIT Introduces new boundary Partition will be added to respective side (L/R)
▫MERGE Deletes boundary Partition will be merged to the respective side
(L/R)•SWITCH IN/OUT
▫Moving partition from partitioned table to other partitioned table called “in”
▫Moving partition from partitioned table to non partitioned table called “out”
<=10 >10 & <=50
>50
<=10 >25 & <=50
>50>10 & <=25
SPLIT – LEFT Boundary
ALTER PARTITION SCHEME MyPartitionScheme_ps NEXT USED [FG]; -- specifying file group for new boundaryALTER PARTITION FUNCTION MyPartitionFunctionName_pfn()SPLIT RANGE(25)
<=10 >25 & <=50
>50>10 & <=25
<=10 >25 & <=50
>50<=25
MERGE – LEFT Boundary
ALTER PARTITION FUNCTION MyPartitionFunctionName_pfn()MERGE RANGE(10)
Partitioned Table
Partition 2
Non Partitioned
tablePartition 1
Partition 1
Partitioned Table
Partition 1
Non Partitioned tablePartition
1
SWITCH IN/OUT says “Hey, its your partition by updating metadata.”
SWITCH OUT
ALTER TABLE PartitionedTableNameSWITCH PARTITION 2 TO NonPartitionedTableName-- <Partition number> TO DestinationPartitionedTableName<destination Partition number>
DemoPresentation and Scripts will be mailed you at the endOr Alternatively available on http://satyasql.wordpress.com
To become master…
Additional Information
•Would not support for composite key•SQL Server 2008 SP2 or Later versions
boosted creation of partitions up to 15000