Overly eager explicit row locking causes deadlockDeadlock on Insert/UpdateDeadlock graph with a lock on an...

A dragon's soul trapped in a ring of mind shielding wants a new body; what magic could enable her to do so?

Is candidate anonymity at all practical?

This Website Needs More Cat Pictures?

Why are these receptacles so difficult to plug into?

Run a command that requires sudo after a time has passed

How to not forget my phone in the bathroom?

Can "so" express a reason not a result?

How to explain one side of Super Earth is smoother than the other side?

Ethernet cable only works in certain positions

Branching points detection in processed image

US ESTA Question confusion

Arbitrary Interval Ruler

"Cheaper by the dozen" phrase origin?

Is there a limit on the layers of encryption a file can have?

Why is the movie titled Gothika?

What happens to someone who dies before their clone has matured?

What does paperwork mean in this sentence?

Why did Shae (falsely) implicate Sansa?

Is there a technology capable of disabling the whole of Earth's satellitle network?

Found a major flaw in paper from home university – to which I would like to return

Why did Tywin never remarry?

How can guns be countered by melee combat without raw-ability or exceptional explanations?

How can I learn to care less because it makes me sick?

Sci fi book, man buys a beat up spaceship and intervenes in a civil war on a planet and eventually becomes a space cop



Overly eager explicit row locking causes deadlock


Deadlock on Insert/UpdateDeadlock graph with a lock on an index on a seemingly unrelated tableUnderstanding SIX lock in Microsoft SQL-ServerClarification on mysql deadlock situation2 phase locking with added increment modeSelect query on an index column with gap lockingWhy does Deadlock occur for this INSERT/UPDATE combination despite seemingly holding an X lock?Simple conditional update causing a deadlock hints at MySQL bugCan two mysql SELECT FOR UPDATE FROM mytable WHERE .. IN (..) deadlock?Is this surprising deadlock reasonable or a MariaDB bug?













0















I'm running into deadlock problems on MariaDB using the INNODB engine.



In my use case, I've got a number of threads working on a table. Each thread first reads a number of rows and then updates those. I'm using a SELECT ... WHERE id IN (...) statement to load all relevant rows at once. I have been using LOCK IN SHARE MODE to ensure that other threads don't cause corruption.



While testing this on a table with a significantly reduced data set I have been experiencing deadlocks - although each thread works on a distinct set of rows. It seems the SELECT ... WHERE id IN (...) locks all rows when the number of ids exceeds a specific fraction of the size of the table. This causes a deadlock as threads attempt to acquire X locks on records which are S-locked by (all) other threads.



I've replicated this behaviour using 10.3.12-MariaDB-1:10.3.12+maria~xenial on a sample data set.



Setup:



CREATE TABLE items (
id bigint unsigned NOT NULL AUTO_INCREMENT,
some_col bigint unsigned,
PRIMARY KEY (id)
) ENGINE=InnoDB;

INSERT INTO items (some_col)
VALUES
(12),
(36),
(72),
(11),
(81),
(53),
(28),
(37),
(58),
(87)
;


Steps using two threads:





  1. Thread A: Acquire locks



    START TRANSACTION;
    SELECT * FROM items WHERE id IN (1, 2, 3, 4, 5) LOCK IN SHARE MODE;


    (Using WHERE id = 1 OR id = 3 OR ... has the same effect.)




  2. Thread B: Acquire locks



    START TRANSACTION;
    SELECT * FROM items WHERE id IN (6, 7, 8, 9, 10) LOCK IN SHARE MODE;



  3. Thread A: Update row with id = 1



    UPDATE items SET some_col=0 WHERE id=1;


    This thread hangs waiting for the X lock on the record with id = 1.




  4. Thread B: Update row with id = 6



    UPDATE items SET some_col=1 WHERE id=6;


    At this point MariaDB will rollback one of the transactions because it detects a deadlock.



    ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction


    SHOW ENGINE INNODB STATUS; indicates that thread A holds S locks on all records in the items table, not just the one returned by the SELECT query in step 1.




When using separate SELECT queries for locking in step 1, this issue does not arise.




Thread A: Acquire locks



SELECT * FROM items WHERE id = 1 LOCK IN SHARE MODE;
SELECT * FROM items WHERE id = 2 LOCK IN SHARE MODE;
SELECT * FROM items WHERE id = 3 LOCK IN SHARE MODE;
SELECT * FROM items WHERE id = 4 LOCK IN SHARE MODE;
SELECT * FROM items WHERE id = 5 LOCK IN SHARE MODE;



The documentation of LOCK IN SHARE says that "… a lock is acquired on the rows read by the query …". The observed behaviour indicates that this means all rows looked at, not just the ones selected.
ANALYZE format=json confirms that the access type is ALL for the SELECT query from step 1.



{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 0.0562,
"table": {
"table_name": "items",
"access_type": "ALL",
"possible_keys": ["PRIMARY"],
"r_loops": 1,
"rows": 10,
"r_rows": 10,
"r_total_time_ms": 0.0373,
"filtered": 50,
"r_filtered": 50,
"attached_condition": "items.`id` in (1,2,3,4,5)"
}
}
}


Is this correct? I.e. does LOCK IN SHARE MODE lock all rows looked at during query evaluation and not just the ones selected?



Is there a reliable way to read / lock only the rows selected (without using individual SELECT statements)?










share|improve this question









New contributor




Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I'm running into deadlock problems on MariaDB using the INNODB engine.



    In my use case, I've got a number of threads working on a table. Each thread first reads a number of rows and then updates those. I'm using a SELECT ... WHERE id IN (...) statement to load all relevant rows at once. I have been using LOCK IN SHARE MODE to ensure that other threads don't cause corruption.



    While testing this on a table with a significantly reduced data set I have been experiencing deadlocks - although each thread works on a distinct set of rows. It seems the SELECT ... WHERE id IN (...) locks all rows when the number of ids exceeds a specific fraction of the size of the table. This causes a deadlock as threads attempt to acquire X locks on records which are S-locked by (all) other threads.



    I've replicated this behaviour using 10.3.12-MariaDB-1:10.3.12+maria~xenial on a sample data set.



    Setup:



    CREATE TABLE items (
    id bigint unsigned NOT NULL AUTO_INCREMENT,
    some_col bigint unsigned,
    PRIMARY KEY (id)
    ) ENGINE=InnoDB;

    INSERT INTO items (some_col)
    VALUES
    (12),
    (36),
    (72),
    (11),
    (81),
    (53),
    (28),
    (37),
    (58),
    (87)
    ;


    Steps using two threads:





    1. Thread A: Acquire locks



      START TRANSACTION;
      SELECT * FROM items WHERE id IN (1, 2, 3, 4, 5) LOCK IN SHARE MODE;


      (Using WHERE id = 1 OR id = 3 OR ... has the same effect.)




    2. Thread B: Acquire locks



      START TRANSACTION;
      SELECT * FROM items WHERE id IN (6, 7, 8, 9, 10) LOCK IN SHARE MODE;



    3. Thread A: Update row with id = 1



      UPDATE items SET some_col=0 WHERE id=1;


      This thread hangs waiting for the X lock on the record with id = 1.




    4. Thread B: Update row with id = 6



      UPDATE items SET some_col=1 WHERE id=6;


      At this point MariaDB will rollback one of the transactions because it detects a deadlock.



      ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction


      SHOW ENGINE INNODB STATUS; indicates that thread A holds S locks on all records in the items table, not just the one returned by the SELECT query in step 1.




    When using separate SELECT queries for locking in step 1, this issue does not arise.




    Thread A: Acquire locks



    SELECT * FROM items WHERE id = 1 LOCK IN SHARE MODE;
    SELECT * FROM items WHERE id = 2 LOCK IN SHARE MODE;
    SELECT * FROM items WHERE id = 3 LOCK IN SHARE MODE;
    SELECT * FROM items WHERE id = 4 LOCK IN SHARE MODE;
    SELECT * FROM items WHERE id = 5 LOCK IN SHARE MODE;



    The documentation of LOCK IN SHARE says that "… a lock is acquired on the rows read by the query …". The observed behaviour indicates that this means all rows looked at, not just the ones selected.
    ANALYZE format=json confirms that the access type is ALL for the SELECT query from step 1.



    {
    "query_block": {
    "select_id": 1,
    "r_loops": 1,
    "r_total_time_ms": 0.0562,
    "table": {
    "table_name": "items",
    "access_type": "ALL",
    "possible_keys": ["PRIMARY"],
    "r_loops": 1,
    "rows": 10,
    "r_rows": 10,
    "r_total_time_ms": 0.0373,
    "filtered": 50,
    "r_filtered": 50,
    "attached_condition": "items.`id` in (1,2,3,4,5)"
    }
    }
    }


    Is this correct? I.e. does LOCK IN SHARE MODE lock all rows looked at during query evaluation and not just the ones selected?



    Is there a reliable way to read / lock only the rows selected (without using individual SELECT statements)?










    share|improve this question









    New contributor




    Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I'm running into deadlock problems on MariaDB using the INNODB engine.



      In my use case, I've got a number of threads working on a table. Each thread first reads a number of rows and then updates those. I'm using a SELECT ... WHERE id IN (...) statement to load all relevant rows at once. I have been using LOCK IN SHARE MODE to ensure that other threads don't cause corruption.



      While testing this on a table with a significantly reduced data set I have been experiencing deadlocks - although each thread works on a distinct set of rows. It seems the SELECT ... WHERE id IN (...) locks all rows when the number of ids exceeds a specific fraction of the size of the table. This causes a deadlock as threads attempt to acquire X locks on records which are S-locked by (all) other threads.



      I've replicated this behaviour using 10.3.12-MariaDB-1:10.3.12+maria~xenial on a sample data set.



      Setup:



      CREATE TABLE items (
      id bigint unsigned NOT NULL AUTO_INCREMENT,
      some_col bigint unsigned,
      PRIMARY KEY (id)
      ) ENGINE=InnoDB;

      INSERT INTO items (some_col)
      VALUES
      (12),
      (36),
      (72),
      (11),
      (81),
      (53),
      (28),
      (37),
      (58),
      (87)
      ;


      Steps using two threads:





      1. Thread A: Acquire locks



        START TRANSACTION;
        SELECT * FROM items WHERE id IN (1, 2, 3, 4, 5) LOCK IN SHARE MODE;


        (Using WHERE id = 1 OR id = 3 OR ... has the same effect.)




      2. Thread B: Acquire locks



        START TRANSACTION;
        SELECT * FROM items WHERE id IN (6, 7, 8, 9, 10) LOCK IN SHARE MODE;



      3. Thread A: Update row with id = 1



        UPDATE items SET some_col=0 WHERE id=1;


        This thread hangs waiting for the X lock on the record with id = 1.




      4. Thread B: Update row with id = 6



        UPDATE items SET some_col=1 WHERE id=6;


        At this point MariaDB will rollback one of the transactions because it detects a deadlock.



        ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction


        SHOW ENGINE INNODB STATUS; indicates that thread A holds S locks on all records in the items table, not just the one returned by the SELECT query in step 1.




      When using separate SELECT queries for locking in step 1, this issue does not arise.




      Thread A: Acquire locks



      SELECT * FROM items WHERE id = 1 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 2 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 3 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 4 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 5 LOCK IN SHARE MODE;



      The documentation of LOCK IN SHARE says that "… a lock is acquired on the rows read by the query …". The observed behaviour indicates that this means all rows looked at, not just the ones selected.
      ANALYZE format=json confirms that the access type is ALL for the SELECT query from step 1.



      {
      "query_block": {
      "select_id": 1,
      "r_loops": 1,
      "r_total_time_ms": 0.0562,
      "table": {
      "table_name": "items",
      "access_type": "ALL",
      "possible_keys": ["PRIMARY"],
      "r_loops": 1,
      "rows": 10,
      "r_rows": 10,
      "r_total_time_ms": 0.0373,
      "filtered": 50,
      "r_filtered": 50,
      "attached_condition": "items.`id` in (1,2,3,4,5)"
      }
      }
      }


      Is this correct? I.e. does LOCK IN SHARE MODE lock all rows looked at during query evaluation and not just the ones selected?



      Is there a reliable way to read / lock only the rows selected (without using individual SELECT statements)?










      share|improve this question









      New contributor




      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm running into deadlock problems on MariaDB using the INNODB engine.



      In my use case, I've got a number of threads working on a table. Each thread first reads a number of rows and then updates those. I'm using a SELECT ... WHERE id IN (...) statement to load all relevant rows at once. I have been using LOCK IN SHARE MODE to ensure that other threads don't cause corruption.



      While testing this on a table with a significantly reduced data set I have been experiencing deadlocks - although each thread works on a distinct set of rows. It seems the SELECT ... WHERE id IN (...) locks all rows when the number of ids exceeds a specific fraction of the size of the table. This causes a deadlock as threads attempt to acquire X locks on records which are S-locked by (all) other threads.



      I've replicated this behaviour using 10.3.12-MariaDB-1:10.3.12+maria~xenial on a sample data set.



      Setup:



      CREATE TABLE items (
      id bigint unsigned NOT NULL AUTO_INCREMENT,
      some_col bigint unsigned,
      PRIMARY KEY (id)
      ) ENGINE=InnoDB;

      INSERT INTO items (some_col)
      VALUES
      (12),
      (36),
      (72),
      (11),
      (81),
      (53),
      (28),
      (37),
      (58),
      (87)
      ;


      Steps using two threads:





      1. Thread A: Acquire locks



        START TRANSACTION;
        SELECT * FROM items WHERE id IN (1, 2, 3, 4, 5) LOCK IN SHARE MODE;


        (Using WHERE id = 1 OR id = 3 OR ... has the same effect.)




      2. Thread B: Acquire locks



        START TRANSACTION;
        SELECT * FROM items WHERE id IN (6, 7, 8, 9, 10) LOCK IN SHARE MODE;



      3. Thread A: Update row with id = 1



        UPDATE items SET some_col=0 WHERE id=1;


        This thread hangs waiting for the X lock on the record with id = 1.




      4. Thread B: Update row with id = 6



        UPDATE items SET some_col=1 WHERE id=6;


        At this point MariaDB will rollback one of the transactions because it detects a deadlock.



        ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction


        SHOW ENGINE INNODB STATUS; indicates that thread A holds S locks on all records in the items table, not just the one returned by the SELECT query in step 1.




      When using separate SELECT queries for locking in step 1, this issue does not arise.




      Thread A: Acquire locks



      SELECT * FROM items WHERE id = 1 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 2 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 3 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 4 LOCK IN SHARE MODE;
      SELECT * FROM items WHERE id = 5 LOCK IN SHARE MODE;



      The documentation of LOCK IN SHARE says that "… a lock is acquired on the rows read by the query …". The observed behaviour indicates that this means all rows looked at, not just the ones selected.
      ANALYZE format=json confirms that the access type is ALL for the SELECT query from step 1.



      {
      "query_block": {
      "select_id": 1,
      "r_loops": 1,
      "r_total_time_ms": 0.0562,
      "table": {
      "table_name": "items",
      "access_type": "ALL",
      "possible_keys": ["PRIMARY"],
      "r_loops": 1,
      "rows": 10,
      "r_rows": 10,
      "r_total_time_ms": 0.0373,
      "filtered": 50,
      "r_filtered": 50,
      "attached_condition": "items.`id` in (1,2,3,4,5)"
      }
      }
      }


      Is this correct? I.e. does LOCK IN SHARE MODE lock all rows looked at during query evaluation and not just the ones selected?



      Is there a reliable way to read / lock only the rows selected (without using individual SELECT statements)?







      innodb mariadb locking deadlock






      share|improve this question









      New contributor




      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 hour ago







      Seoester













      New contributor




      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 19 hours ago









      SeoesterSeoester

      12




      12




      New contributor




      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Seoester is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          1















          • Would it suffice to SELECT ... FOR UPDATE instead?


          • Can we look at the entire transaction? Speeding it up will decrease the frequency of deadlocks.


          • Even if you find a way around this deadlock, you must prepare to get deadlocks. Usually, it suffices to re-run starting with the START TRANSACTION.



          Another approach might prevent the "over-eager" problem:



          Put the list of ids in a table (possibly a TEMPORARY table). Then JOIN to it instead of using IN ( big list ).






          share|improve this answer
























          • Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

            – Seoester
            1 hour ago













          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
          });


          }
          });






          Seoester is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f230065%2foverly-eager-explicit-row-locking-causes-deadlock%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1















          • Would it suffice to SELECT ... FOR UPDATE instead?


          • Can we look at the entire transaction? Speeding it up will decrease the frequency of deadlocks.


          • Even if you find a way around this deadlock, you must prepare to get deadlocks. Usually, it suffices to re-run starting with the START TRANSACTION.



          Another approach might prevent the "over-eager" problem:



          Put the list of ids in a table (possibly a TEMPORARY table). Then JOIN to it instead of using IN ( big list ).






          share|improve this answer
























          • Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

            – Seoester
            1 hour ago


















          1















          • Would it suffice to SELECT ... FOR UPDATE instead?


          • Can we look at the entire transaction? Speeding it up will decrease the frequency of deadlocks.


          • Even if you find a way around this deadlock, you must prepare to get deadlocks. Usually, it suffices to re-run starting with the START TRANSACTION.



          Another approach might prevent the "over-eager" problem:



          Put the list of ids in a table (possibly a TEMPORARY table). Then JOIN to it instead of using IN ( big list ).






          share|improve this answer
























          • Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

            – Seoester
            1 hour ago
















          1












          1








          1








          • Would it suffice to SELECT ... FOR UPDATE instead?


          • Can we look at the entire transaction? Speeding it up will decrease the frequency of deadlocks.


          • Even if you find a way around this deadlock, you must prepare to get deadlocks. Usually, it suffices to re-run starting with the START TRANSACTION.



          Another approach might prevent the "over-eager" problem:



          Put the list of ids in a table (possibly a TEMPORARY table). Then JOIN to it instead of using IN ( big list ).






          share|improve this answer














          • Would it suffice to SELECT ... FOR UPDATE instead?


          • Can we look at the entire transaction? Speeding it up will decrease the frequency of deadlocks.


          • Even if you find a way around this deadlock, you must prepare to get deadlocks. Usually, it suffices to re-run starting with the START TRANSACTION.



          Another approach might prevent the "over-eager" problem:



          Put the list of ids in a table (possibly a TEMPORARY table). Then JOIN to it instead of using IN ( big list ).







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 16 hours ago









          Rick JamesRick James

          42.8k22258




          42.8k22258













          • Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

            – Seoester
            1 hour ago





















          • Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

            – Seoester
            1 hour ago



















          Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

          – Seoester
          1 hour ago







          Thanks for taking the time @Rick James :) 1. Using FOR UPDATE would force all queries to run in sequence. 2. I clarified the steps above. The problem is not the run time of the transaction but that there can only ever be one running. 3. Of course. 4. How would a secondary table prevent the deadlock problem? Locking would have to occur on either the primary table (same issue) or the secondary one (exacerbated issue as there are fewer rows).

          – Seoester
          1 hour ago












          Seoester is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Seoester is a new contributor. Be nice, and check out our Code of Conduct.













          Seoester is a new contributor. Be nice, and check out our Code of Conduct.












          Seoester is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f230065%2foverly-eager-explicit-row-locking-causes-deadlock%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

          ORA-01691 (unable to extend lob segment) even though my tablespace has AUTOEXTEND onORA-01692: unable to...

          Always On Availability groups resolving state after failover - Remote harden of transaction...

          Circunscripción electoral de Guipúzcoa Referencias Menú de navegaciónLas claves del sistema electoral en...