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

     
     
     
     





  • 相关阅读:
    javascript如何实现图片隐藏?
    TypeScript数字分隔符和更严格的类属性检查
    JS 原生闭包模块化开发总结
    详解浏览器储存
    对象扩展运算符和 rest 运算符及 keyof 和查找类型
    Js实现动态轮播图效果
    javascript选择器有哪些?
    javascript的事件流模型都有什么?
    理解JavaScript中的语法和代码结构
    14. Cantor表
  • 原文地址:https://www.cnblogs.com/ECNB/p/4611317.html
Copyright © 2011-2022 走看看