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

     
     
     
     





  • 相关阅读:
    03 选看 OpenID Connect 简介
    02 选看 OAuth 2.0 简介(下)
    01 选看 OAuth 2.0 简介(上)
    07 为 MVC 客户端刷新 Token
    06 Authorization Code Flow 实例
    05 Resource Owner Password Credentials 授权
    04 建立 IdentityServer4 项目,Client Credentials
    Identity Server 4 原理和实战(完结)
    依赖注入 Unity入门
    依赖注入 Autofac的高级使用
  • 原文地址:https://www.cnblogs.com/ECNB/p/4611317.html
Copyright © 2011-2022 走看看