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

     
     
     
     





  • 相关阅读:
    java多线程练习题 类
    java练习题在一个文件里面输入内容在另一个文件里面可以查看
    java练习题输入流姓名学号信息
    java 异常处理2
    java 处理异常练习题
    java get银行练习题
    java 练习题 求梯形的面积和周长
    java get正确写类的练习题 猫
    GUID 全局唯一标识符
    oracle 建表 练习2
  • 原文地址:https://www.cnblogs.com/ECNB/p/4611317.html
Copyright © 2011-2022 走看看