• <small id='1oNl6'></small><noframes id='1oNl6'>

    1. <legend id='1oNl6'><style id='1oNl6'><dir id='1oNl6'><q id='1oNl6'></q></dir></style></legend>
        <bdo id='1oNl6'></bdo><ul id='1oNl6'></ul>
    2. <tfoot id='1oNl6'></tfoot>
      <i id='1oNl6'><tr id='1oNl6'><dt id='1oNl6'><q id='1oNl6'><span id='1oNl6'><b id='1oNl6'><form id='1oNl6'><ins id='1oNl6'></ins><ul id='1oNl6'></ul><sub id='1oNl6'></sub></form><legend id='1oNl6'></legend><bdo id='1oNl6'><pre id='1oNl6'><center id='1oNl6'></center></pre></bdo></b><th id='1oNl6'></th></span></q></dt></tr></i><div id='1oNl6'><tfoot id='1oNl6'></tfoot><dl id='1oNl6'><fieldset id='1oNl6'></fieldset></dl></div>
      1. 将事务用于选择语句?

        时间:2023-10-25

          <i id='9SNpD'><tr id='9SNpD'><dt id='9SNpD'><q id='9SNpD'><span id='9SNpD'><b id='9SNpD'><form id='9SNpD'><ins id='9SNpD'></ins><ul id='9SNpD'></ul><sub id='9SNpD'></sub></form><legend id='9SNpD'></legend><bdo id='9SNpD'><pre id='9SNpD'><center id='9SNpD'></center></pre></bdo></b><th id='9SNpD'></th></span></q></dt></tr></i><div id='9SNpD'><tfoot id='9SNpD'></tfoot><dl id='9SNpD'><fieldset id='9SNpD'></fieldset></dl></div>
            <tbody id='9SNpD'></tbody>
                <legend id='9SNpD'><style id='9SNpD'><dir id='9SNpD'><q id='9SNpD'></q></dir></style></legend>
              1. <small id='9SNpD'></small><noframes id='9SNpD'>

                <tfoot id='9SNpD'></tfoot>
                  <bdo id='9SNpD'></bdo><ul id='9SNpD'></ul>
                  本文介绍了将事务用于选择语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我不经常使用存储过程,我想知道将我的选择查询包装在事务中是否有意义.

                  I don't use Stored procedures very often and was wondering if it made sense to wrap my select queries in a transaction.

                  我的程序有三个简单的选择查询,其中两个使用第一个的返回值.

                  My procedure has three simple select queries, two of which use the returned value of the first.

                  推荐答案

                  在高度并发的应用程序中,(理论上)可能会发生在第一个选择中读取的数据在其他选择执行之前被修改的情况.

                  In a highly concurrent application it could (theoretically) happen that data you've read in the first select is modified before the other selects are executed.

                  如果您的应用程序中可能发生这种情况,您应该使用事务来包装您的选择.请确保选择正确的隔离级别,但并非所有事务类型都能保证一致的读取.

                  If that is a situation that could occur in your application you should use a transaction to wrap your selects. Make sure you pick the correct isolation level though, not all transaction types guarantee consistent reads.

                  更新:您还可以找到关于并发更新/插入解决方案(又名upsert)有趣.它把几种常用的 upsert 方法放到测试中,看看是什么方法实际上保证数据在 select 和 next 语句之间没有被修改.结果是,嗯,令人震惊.

                  Update : You may also find this article on concurrent update/insert solutions (aka upsert) interesting. It puts several common methods of upsert to the test to see what method actually guarantees data is not modified between a select and the next statement. The results are, well, shocking I'd say.

                  这篇关于将事务用于选择语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:查看 MySQL 中的存储过程/函数定义 下一篇:在 BEGIN/END TRANSACTION 中执行存储过程

                  相关文章

                    • <bdo id='ZKDMc'></bdo><ul id='ZKDMc'></ul>

                      <tfoot id='ZKDMc'></tfoot>

                      <small id='ZKDMc'></small><noframes id='ZKDMc'>

                      <i id='ZKDMc'><tr id='ZKDMc'><dt id='ZKDMc'><q id='ZKDMc'><span id='ZKDMc'><b id='ZKDMc'><form id='ZKDMc'><ins id='ZKDMc'></ins><ul id='ZKDMc'></ul><sub id='ZKDMc'></sub></form><legend id='ZKDMc'></legend><bdo id='ZKDMc'><pre id='ZKDMc'><center id='ZKDMc'></center></pre></bdo></b><th id='ZKDMc'></th></span></q></dt></tr></i><div id='ZKDMc'><tfoot id='ZKDMc'></tfoot><dl id='ZKDMc'><fieldset id='ZKDMc'></fieldset></dl></div>
                      <legend id='ZKDMc'><style id='ZKDMc'><dir id='ZKDMc'><q id='ZKDMc'></q></dir></style></legend>