如何对没有主键的表进行分区。 [英] How to partition a table which has no primary key.

查看:181
本文介绍了如何对没有主键的表进行分区。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想分区一个表(ResultHistory),它没有主键,没有约束,而是一个列(AuditID),它是其他表(Audit)中的主键。

I want to partition a table (ResultHistory) which has no Primary key,No Constraints but a column (AuditID) which is a primary key in other table (Audit).

RowCount  ResultHistory  = 6945264015

RowCount ResultHistory  =6945264015

RowCount 审核  =  16793601

RowCount Audit  = 16793601

表的设计  ResultHistory:

表审核设计:

推荐答案

A主键不是分区的要求,Ajay。

A Primary Key is not a requirement for partitioning, Ajay.

您需要做的就是在该表上创建聚簇索引,并将该索引与相关的索引对齐分区方案。

All you need to do is create a Clustered Index on that table, and align that index with the relevant partition scheme.

一般语法是:

CREATE CLUSTERED INDEX [index_name]

ON [DBO]。[表名]([key_column_name] ASC)

ON [dbo].[table_name] ([key_column_name] ASC)

ON [Partition_Scheme_Name]([partitioned_key_column_name])

ON [Partition_Scheme_Name]([partitioned_key_column_name])





这篇关于如何对没有主键的表进行分区。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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