zoukankan      html  css  js  c++  java
  • Partition Table

    what is Partition Table?

    Looking to optimize the performance of your SQL Server database? If your database contains very large tables, you may benefit from partitioning those tables onto separate filegroups. Allows you to spread data onto different physical disks, leveraging the concurrent performance of those disks to optimize query performance.

    Partitioning a SQL Server database table is a three-step process:

    1. Create the partition function
        CREATE PARTITION FUNCTION customer_partfunc (int)
        AS RANGE RIGHT
        FOR VALUES (250000, 500000, 750000)
    2. Create the partition scheme
        CREATE PARTITION SCHEME customer_partscheme
        AS PARTITION customer_partfunc
        TO (fg1, fg2, fg3, fg4)
    3. Partition the table
        CREATE TABLE customers (FirstName nvarchar(40), LastName nvarchar(40), CustomerNumber int)
        ON customer_partscheme (CustomerNumber)

    Creates a scheme in the current database that maps the partitions of a partitioned table or index to filegroups. The number and domain of the partitions of a partitioned table or index are determined in a partition function. A partition function must first be created in a CREATE PARTITION FUNCTION statement before creating a partition scheme.

    CREATE PARTITION SCHEME partition_scheme_name
    AS PARTITION partition_function_name
    [ ALL ] TO ( { file_group_name | [ PRIMARY ] } [ ,...n ] )
    [ ; ]
     

    The following example creates a partition function to partition a table or index into four partitions. A partition scheme is then created that specifies the filegroups to hold each one of the four partitions. This example assumes the filegroups already exist in the database.

    CREATE PARTITION FUNCTION myRangePF1 (int)
    AS RANGE LEFT FOR VALUES (1, 100, 1000);
    GO
    CREATE PARTITION SCHEME myRangePS1
    AS PARTITION myRangePF1
    TO (test1fg, test2fg, test3fg, test4fg);

    The partitions of a table that uses partition function myRangePF1 on partitioning column col1 would be assigned as shown in the following table.

    Filegroup

    test1fg

    test2fg

    test3fg

    test4fg

    Partition

    1

    2

    3

    4

    Values

    col1 <= 1

    col1 > 1 AND col1 <= 100

    col1 > 100 AND col1 <= 1000

    col1 > 1000

     
     
     
     





  • 相关阅读:
    JS,JQuery的扩展方法
    Listbox简单用法
    Button模板,样式
    WPF开发经验
    弹出窗体主体实现事件
    从一知半解到揭晓Java高级语法—泛型
    深入理解Java之装箱与拆箱
    探究 — 二叉搜索树
    深入理解二叉树(超详细)
    二分查找及其变种算法
  • 原文地址:https://www.cnblogs.com/ECNB/p/4611317.html
Copyright © 2011-2022 走看看