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

     
     
     
     





  • 相关阅读:
    C# 利用TTS实现文本转语音
    Windows10提示“没有权限使用网络资源”的解决方案
    INSPIRED启示录 读书笔记
    INSPIRED启示录 读书笔记
    phpfpm的配置
    session 的工作原理
    MySQL 事务
    Redis各种数据类型的使用场景
    JavaScript 和Ajax跨域问题
    如何做URL静态化 和页面的静态化
  • 原文地址:https://www.cnblogs.com/ECNB/p/4611317.html
Copyright © 2011-2022 走看看