Uploaded image for project: 'CFA MX '
  1. CFA MX
  2. CFAMX-10247

Reduce deadlocks on qryMMSInventory_Deduct*

    Details

      Description

      The Deduct* procs are the most deadlocking procedures in the database, and should be able to be modified simply to reduce the number of deadlocks.

      The suggestion from the SQL optimization consultant is:

      1. Remove “WITH (ROWLOCK)” when updating live tables. Let SQL decide the best lock to use.
        i.e. :
        From :
        	UPDATE tbItemQty WITH (ROWLOCK) 
        	SET
        		fOnHand_qty -= @Quantity,
        		fAvailable_qty -= @Quantity 
        	WHERE EntityID = @EntityID 
        		AND ItemID = @ItemID
        

      To :

      	UPDATE tbItemQty 
      	SET
      		fOnHand_qty -= @Quantity,
      		fAvailable_qty -= @Quantity 
      	WHERE EntityID = @EntityID 
      		AND ItemID = @ItemID
      

      Also, there are 5 procs that all update the same tables in the same order

      qryMMSInventory_DeductWaste
      qryMMSInventory_DeductSale
      qryMMSInventory_DeductProductionUse
      qryMMSInventory_DeductInternalUse
      qryMMSInventory_DeductEOD

      But the proc qryMMSInventory_StockCount updates the same tables but in different order and causes blocking. I suggest this proc gets amended to do the updates in the same order as the qryMMSInventory_Deduct procs.

        Attachments

          Issue Links

          1.
          Modify sprocs Dev Task Ready for Developer Unassigned

          0%

          Original Estimate - 4h
          Remaining Estimate - 4h
          2.
          Test new procedures QA Task Ready for QA Unassigned

          0%

          Original Estimate - 21h
          Remaining Estimate - 21h

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Corey.Amend Corey Amend (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.