SQL Azure 的限制不是搬起石头砸自己的脚吗?

发布于 2024-09-30 15:13:55 字数 723 浏览 1 评论 0原文

考虑我的问题“是否应该避免快照事务隔离那么,它的主要用途是什么?”,
SQL Azure 数据库严格限制的目的/原理/意义是什么:

不是后者吗?与 SQL Azure 数据库矛盾连接约束

  • "由于以下情况,您与服务的连接可能会被关闭:

    • 资源使用过多
    • 空闲时间达到或超过 30 分钟的连接”

Considering my question "Should snapshot transaction isolation be avoided in client ADO.NET applications? then, what was its main purpose?",
what is the purpose/rationale/sense under SQL Azure Database rigid limitation:

Isn't the latter, also, in contradiction with SQL Azure Database Connection Constraints:

  • "your connection to the service may be closed due to the following conditions:

    • Excessive resource usage
    • Connections that have been idle for 30 minutes or longer"

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

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

发布评论

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

评论(1

生寂 2024-10-07 15:13:55

快照隔离绝对是迄今为止最好的选择。从您提供的所有链接来看,唯一正确的缺点是行版本控制的开销< /a>.为了使用快照隔离,绝对不需要“持久”数据库连接。您链接的丹·古兹曼的文章充其量只是误导性的。虽然它没有提出错误的主张,但它阐述问题的方式会导致错误的结论。

您始终可以使用乐观并发模型进行更新来开发应用程序:

读取:

SELECT
      ContactName,
      ContactTitle
FROM dbo.Suppliers
WHERE SupplierID = @SupplierID;

写入:

UPDATE dbo.Suppliers
SET
      ContactName = @NewContactName,
      ContactTitle = @NewContactTitle
WHERE
      SupplierID = @SupplierID AND
      ContactName = @OriginalContactName AND
      ContactTitle = @OriginalContactTitle;

IF @@ROWCOUNT = 0 --a zero rowcount indicates data was deleted or changed
BEGIN
      RAISERROR ('Contact information was changed by another user', 16, 1);
END;

绝对不要求读取和写入应发生在同一连接中。绝对肯定的是,您可以在快照隔离下进行读写并获得乐观并发控制。本文给出了一个依赖于 SNAPSHOT 隔离而不是乐观并发控制的并发示例,但当然,这样做已经默默改变了应用程序的一切:在第二个示例中读取和写入必须发生在同一事务中,因此不再是与第一个示例相同的场景(它不能是典型的读取-显示-后处理更新为第一个场景)。

所以,SQL Azure 不会搬起石头砸自己的脚。快照隔离也不需要持久连接。 SNAPSHOT 隔离也不能与 ASP.Net 一起使用。恐怕我不得不说你需要更好地过滤你的输入。仔细研究你在管间找到的东西,假设一切都是错的,直到被证明是正确的,坚持官方产品规格,避免博客、专家或论坛/答案网站,如 stackoverflow...

SNAPSHOT isolation is absolutely by far the best to go with. The only correct downside, from all the links you provided, is that overhead of row versioning. There is absolutely no requirement for a 'persisted' database connection in order to use SNAPSHOT isolation. Dan Guzman's article you link is misleading at best. While it does not make a false claim, the way it formulates the issue leads to false conclusions.

You can always develop your applications using optimistic concurrency model for updates:

Read:

SELECT
      ContactName,
      ContactTitle
FROM dbo.Suppliers
WHERE SupplierID = @SupplierID;

Write:

UPDATE dbo.Suppliers
SET
      ContactName = @NewContactName,
      ContactTitle = @NewContactTitle
WHERE
      SupplierID = @SupplierID AND
      ContactName = @OriginalContactName AND
      ContactTitle = @OriginalContactTitle;

IF @@ROWCOUNT = 0 --a zero rowcount indicates data was deleted or changed
BEGIN
      RAISERROR ('Contact information was changed by another user', 16, 1);
END;

There is absolutely no requirement that the Read and the Write should occur in the same connection. And absolutely, positively, you can read and write under SNAPSHOT isolation and obtain optimistic concurrency control. The article gives an example of concurrency that relies on SNAPSHOT isolation instead of optimistic concurrency control, but of course in doing so it has silently changed everything about the application: in the second example the Read and the Write must occur in the same transaction, therefore is no longer the same scenario as the first example (it cannot be a typical read-display-post-update as the first scenario).

So no, SQL Azure does not shoot itself in the foot. Nor does SNAPSHOT isolation require persisted connections. Nor is SNAPSHOT isolation unusable with ASP.Net. I'm afraid I have to say you need to filter your input much better. Rummage a bit longer on what you find on the intertubes, assume everything is wrong until proven right, stick to the official product specifications and avoid blogs, pundits, or forum/answer sites like stackoverflow...

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