如何在sqlserver2008 r2中创建partion表 [英] how to create partion table in sqlserver2008 r2

查看:91
本文介绍了如何在sqlserver2008 r2中创建partion表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有tblTest表,下面给出了哪个脚本

I have tblTest table which script is given below

CREATE TABLE [dbo].[tblTest](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [Region] [varchar](50) NULL,
    [Name] [varchar](50) NULL,
 CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]





它的数据类似于

ID地区名称

1 Newyork Joy

2 Seatle女士

3拉斯维加斯汤姆



我想要分手在像纽约这样的地区的基础上我想要与其他地区的Seatle和Las vegas一样的单独的分区表。

我将从分区表中删除Neyork等区域中的现有日期,并将最新数据存储在其中。数据可以有400K行,出于单一原因,如neyyork等





请尽快通知我,我该怎么办



提前感谢



问候,

YAsh



it has data like
ID Region Name
1 Newyork Joy
2 Seatle lady
3 Las vegas tom

I want to do partion on the basis of Region like for newyork i want seperate partion table same for other region Seatle and Las vegas.
I will delete the existing date from the table on the basis of region like Neyork from partion table and store the latest data in it. Data can have 400K rows for single reason like neyyork etc


Please let me know asap how can i do it

thanks in advance

Regards,
YAsh

推荐答案

首先,我真的不会根据区域将数据分成几个表。如果你担心性能,请专注于索引和SQL执行计划。



但是,如果你真的需要这样做有充分理由,我建议你你使用分区表。有关详细信息,请参阅分区表和索引 [ ^ ]
First of all, I really wouldn't separate the data into several tables based on the region. If you're worried about performance, concentrate on indexing and the SQL execution plans.

However, if you really need to do this for a good reason, I suggest that you use partitioned tables. For more information, see Partitioned Tables and Indexes[^]


这篇关于如何在sqlserver2008 r2中创建partion表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆