MARS(多个活动结果集)的缺点?

发布于 2024-07-10 02:16:55 字数 77 浏览 4 评论 0原文

有谁知道 MARS(多个活动结果集)有什么缺点吗? 有谁知道为什么应该避免使用 MARS 的任何原因,例如游标比 MARS 更有用的情况。

Does anyone know of any disadvantages of MARS (Multiple Active Result Sets)? Does anyone know of any reason why one should avoid using MARS, like cases where cursors are more useful then MARS.

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

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

发布评论

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

评论(3

情丝乱 2024-07-17 02:16:55

显然至少有两个已知(潜在)缺点(来自此(1)团队博客):

  1. 显然,这可能会给任何未设计为针对支持 MARS 的设计运行的遗留系统带来潜在问题 - “现有代码经过优化,可以在非在未经 MARS 修改的情况下运行时,MARS 世界可能会出现轻微的性能下降”

  2. “使用 MARS,您可以向服务器发送多个多语句批次。 服务器将交错执行此类批处理,这意味着如果批处理通过 SET 或 USE 语句更改服务器状态,或者使用 TSQL 事务管理语句(BEGIN TRAN、COMMIT、ROLLBACK),您和服务器都会感到困惑关于你的实际意图是什么。”

我还没有尝试过支持 MARS 的设计,但在我当前的项目中我已经非常接近这样做了 我们在竞争(有时是依赖)查询操作方面遇到了一个小问题(例如从活动记录集正在执行的同一数据库中延迟加载配置数据)。

MSDN 网站(2) 此处

[ (1 ) https://web.archive.org/web/20190911155929/https://blogs.msdn.microsoft.com/sqlnativeclient/2006/09/27/using-mars-with- sql-native-client/ ]
[ (2) http://msdn.microsoft.com/en-us/库/ms131686.aspx]

There are apparently at least two known (potential) drawbacks (from this (1) Team blog):

  1. Obviously this can cause potential problems for any legacy systems which weren't designed to run against a MARS enabled design - "existing code optimized to run in the non-MARS world may show a slight performance dip when run un-modified with MARS"

  2. “With MARS you can send multiple multi-statement batches to the server. The server will interleave execution of such batches, which means that if the batches change server state via SET or USE statements, for example, or use TSQL transaction management statements (BEGIN TRAN, COMMIT, ROLLBACK), both you and the server can get confused about what your actual intent is.”

I've yet to try out a MARS enabled design, but I'm coming very close to doing so on my current project. We have a slight issue with competing (and sometimes dependent) query operations (like lazy loading configuration data out of the same database that an active recordset is executing).

There's more information on the MSDN site (2) here

[ (1) https://web.archive.org/web/20190911155929/https://blogs.msdn.microsoft.com/sqlnativeclient/2006/09/27/using-mars-with-sql-native-client/ ]
[ (2) http://msdn.microsoft.com/en-us/library/ms131686.aspx ]

无言温柔 2024-07-17 02:16:55
幸福%小乖 2024-07-17 02:16:55

取决于什么? 没有真正的缺点。

他们不支持事务保存点。 但我不认为这是一个缺点。

depending on what? there are no real disadvantages.

they don't support Transaction savepoints. but i don't think of this as a disadvantage.

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