MARS(多个活动结果集)的缺点?
有谁知道 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
显然至少有两个已知(潜在)缺点(来自此(1)团队博客):
显然,这可能会给任何未设计为针对支持 MARS 的设计运行的遗留系统带来潜在问题 - “现有代码经过优化,可以在非在未经 MARS 修改的情况下运行时,MARS 世界可能会出现轻微的性能下降”
“使用 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):
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"
“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 ]
取决于什么? 没有真正的缺点。
他们不支持事务保存点。 但我不认为这是一个缺点。
depending on what? there are no real disadvantages.
they don't support Transaction savepoints. but i don't think of this as a disadvantage.