且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 SQL Server 中对大表进行分区的***方法是什么?

更新时间:2022-11-27 11:08:59

我认为通过在单个服务器中跨多个数据库对表进行分区,您不会真正获得任何好处.通过在单个 SQL Server 实例下拥有多个实例(即在两个不同的数据库中打开),您基本上所做的一切首先增加了使用表"的开销.

I don't think that you are really going to gain anything by partitioning the table across multiple databases in a single server. All you have essentially done there is increased the overhead in working with the "table" in the first place by having several instances (i.e. open in two different DBs) of it under a single SQL Server instance.

你有多大的数据集?我有一个客户端在 SQL Server 中有一个 600 万行的表,其中包含 2 年的销售数据.他们在事务中使用它并进行报告,而没有任何明显的速度问题.

How large of a dataset do you have? I have a client with a 6 million row table in SQL Server that contains 2 years worth of sales data. They use it transactionally and for reporting without any noticiable speed problems.

调整索引并选择正确的聚集索引当然对性能至关重要.

Tuning the indexes and choosing the correct clustered index is crucial to performance of course.

如果您的数据集非常大,并且您希望进行分区,那么跨物理服务器对表进行分区会更划算.

If your dataset is really large and you are looking to partition, you will get more bang for your buck partitioning the table across physical servers.