Update Statement on one table takes locks on other tablesHow do I determine what object two SQL process are...

Why is so much work done on numerical verification of the Riemann Hypothesis?

How much of a Devil Fruit must be consumed to gain the power?

Make a Bowl of Alphabet Soup

Non-trope happy ending?

meaning of encore in this sentence

Microchip documentation does not label CAN buss pins on micro controller pinout diagram

What is the difference between lands and mana?

Which Article Helped Get Rid of Technobabble in RPGs?

Why is it that I can sometimes guess the next note?

How can I write humor as character trait?

What kind of floor tile is this?

Why should universal income be universal?

"It doesn't matter" or "it won't matter"?

Is this part of the description of the Archfey warlock's Misty Escape feature redundant?

Will number of steps recorded on FitBit/any fitness tracker add up distance in PokemonGo?

How does electrical safety system work on ISS?

Is there any evidence that Cleopatra and Caesarion considered fleeing to India to escape the Romans?

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Does "he squandered his car on drink" sound natural?

How could a planet have erratic days?

Stack Interview Code methods made from class Node and Smart Pointers

Biological Blimps: Propulsion

How do you make your own symbol when Detexify fails?

Can I say "fingers" when referring to toes?



Update Statement on one table takes locks on other tables


How do I determine what object two SQL process are contending over?How does the table scan in an UPDATE WHERE predicated on an unindexed column work?In Sql Server, is there a way to check if a selected group of rows are locked or not?innodb update with limit locks all matching (ignores limit)What happens during RCSI while tempdb is being populated?Does MariaDB require aliases for subquery table locks?why I can't find locked table?Update Query DeadLock in SQL Server when ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT are enabledDoes this set of locks imply table lock and if so is it avoidable?Causes for pg_class locks except DROP TABLE













0















Given the following statement on the AdventureWorks database:



UPDATE Sales.SalesOrderDetail SET OrderQty = 100 WHERE ModifiedDate >= '2014-01-01'



If I open another query window and look at the locks the query is using by running



sp_WhoIsActive @get_locks =1



i can see locks as follows:



   <Object name="Person" schema_name="Person">
<Locks>
<Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
</Locks>
</Object>
<Object name="SalesOrderDetail" schema_name="Sales">
<Locks>
<Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
</Locks>
</Object>
<Object name="SalesOrderHeader" schema_name="Sales">
<Locks>
<Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
</Locks>
</Object>


I was expecting the table lock on SalesOrderDetail however, I don't understand why the table lock has been taken on the Person Table and the SalesOrderHeader table



I can confirm the locks are present by trying to SELECT * from one of the tables which is then blocked.



Why are tables that are not being updated locked by the update statement?









share



























    0















    Given the following statement on the AdventureWorks database:



    UPDATE Sales.SalesOrderDetail SET OrderQty = 100 WHERE ModifiedDate >= '2014-01-01'



    If I open another query window and look at the locks the query is using by running



    sp_WhoIsActive @get_locks =1



    i can see locks as follows:



       <Object name="Person" schema_name="Person">
    <Locks>
    <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
    </Locks>
    </Object>
    <Object name="SalesOrderDetail" schema_name="Sales">
    <Locks>
    <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
    </Locks>
    </Object>
    <Object name="SalesOrderHeader" schema_name="Sales">
    <Locks>
    <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
    </Locks>
    </Object>


    I was expecting the table lock on SalesOrderDetail however, I don't understand why the table lock has been taken on the Person Table and the SalesOrderHeader table



    I can confirm the locks are present by trying to SELECT * from one of the tables which is then blocked.



    Why are tables that are not being updated locked by the update statement?









    share

























      0












      0








      0








      Given the following statement on the AdventureWorks database:



      UPDATE Sales.SalesOrderDetail SET OrderQty = 100 WHERE ModifiedDate >= '2014-01-01'



      If I open another query window and look at the locks the query is using by running



      sp_WhoIsActive @get_locks =1



      i can see locks as follows:



         <Object name="Person" schema_name="Person">
      <Locks>
      <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
      </Object>
      <Object name="SalesOrderDetail" schema_name="Sales">
      <Locks>
      <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
      </Object>
      <Object name="SalesOrderHeader" schema_name="Sales">
      <Locks>
      <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
      </Object>


      I was expecting the table lock on SalesOrderDetail however, I don't understand why the table lock has been taken on the Person Table and the SalesOrderHeader table



      I can confirm the locks are present by trying to SELECT * from one of the tables which is then blocked.



      Why are tables that are not being updated locked by the update statement?









      share














      Given the following statement on the AdventureWorks database:



      UPDATE Sales.SalesOrderDetail SET OrderQty = 100 WHERE ModifiedDate >= '2014-01-01'



      If I open another query window and look at the locks the query is using by running



      sp_WhoIsActive @get_locks =1



      i can see locks as follows:



         <Object name="Person" schema_name="Person">
      <Locks>
      <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
      </Object>
      <Object name="SalesOrderDetail" schema_name="Sales">
      <Locks>
      <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
      </Object>
      <Object name="SalesOrderHeader" schema_name="Sales">
      <Locks>
      <Lock resource_type="OBJECT" request_mode="X" request_status="GRANT" request_count="1" />
      </Locks>
      </Object>


      I was expecting the table lock on SalesOrderDetail however, I don't understand why the table lock has been taken on the Person Table and the SalesOrderHeader table



      I can confirm the locks are present by trying to SELECT * from one of the tables which is then blocked.



      Why are tables that are not being updated locked by the update statement?







      sql-server-2014 locking concurrency





      share












      share










      share



      share










      asked 54 secs ago









      SEarle1986SEarle1986

      517317




      517317






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232803%2fupdate-statement-on-one-table-takes-locks-on-other-tables%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232803%2fupdate-statement-on-one-table-takes-locks-on-other-tables%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Parapolítica Índice Antecedentes El escándalo Proceso judicial Consecuencias Véase...

          How to remove border from elements in the last row?Targeting flex items on the last rowHow to vertically wrap...

          How does insurance birth control work in the United States?How does the Social Security Work in United...