制定归档或分区策略?

发布于 2024-09-16 21:19:38 字数 210 浏览 1 评论 0原文

我们使用的是SQL Server 2008。

我们的要求是这样的——

我们有大约4个与交易相关的表,这些表记录了消费者下的订单,以及他们的交货状态。一旦订单完成,它就会影响库存和财务。 现在,这些表将变得巨大。因此,我们希望每 6-8 个月归档一次。但是,归档后库存和财务计算不应受到影响。那么,分区对我们来说是一个正确的选择吗?它将如何影响查询?我们应该如何处理这个问题?

We are using SQL Server 2008.

Our requirement is this -

We have about 4 tables related to transactions, which record orders placed by consumers, and their status of delivery.Once,the order is completed it has affect on inventory and finance.
Now,these tables will become huge.So,we want to archive every 6-8 months.But,after archiving the inventory and financial calculations should not be affected.So,is partition a right option for us? how will it affect the queries? How should we approach this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蘑菇王子 2024-09-23 21:19:38

这取决于。

我能想到的两种主要方法是表分区(将表分成不同的文件组)或将数据物理移动到其他地方(即报告服务器)。

在我看来,最简单的脚本是将数据移动作为每晚批处理,这就是我目前工作的地方所使用的。每晚,我们将超过阈值的数据 bcp 输出、bcp 到报告服务器中并验证两个表的正确性。

最终你必须决定什么是更好的。您需要不断查询存档数据吗?存档的数据还会被查询吗?也许迁移到另一台硬件速度较慢的服务器比将查询量不太大的数据保留在速度较快的硬件中更便宜。由你决定。

It depends.

The two main approaches I can think of is either table partitioning (separating the table into different filegroups) or physical movement of data to somewhere else (ie. reporting server).

Imo, the easiest to script would be the data movement as a nightly batch, which is currently what is used where I work. Nightly we bcp data past the threshold out, bcp in the reporting server and verify both tables for correctness.

Ultimately you have to decided what is better. Will you need to constant query archived data? Archived data will even be queried? Perhaps it is cheaper to move to another server with slower hardware than to keep not-so-heavily-queried data in the faster hardware. Up to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文