dp-900 Practice Question 1821
Exam: dp-900
Domain: Describe how to work with relational data on Azure
Topic: Describe relational data workloads
Difficulty: medium
During a routine maintenance task at Contoso Ltd, you notice that the `Orders` table in the company's SQL Server database is experiencing frequent deadlocks. The `Orders` table is related to the `Customers` and `Products` tables through foreign keys. What action should you take to reduce the likelihood of deadlocks occurring in this scenario?
Answer Options
A
Increase the lock timeout value for the `Orders` table.
B
Ensure that all transactions access the `Orders`, `Customers`, and `Products` tables in the same order.
C
Disable the foreign key constraints on the `Orders` table.
D
Use NOLOCK hint on the `Orders` table to avoid locking conflicts.
Correct Answer
B: Ensure that all transactions access the `Orders`, `Customers`, and `Products` tables in the same order.
Explanation
The correct answer is B. To reduce the likelihood of deadlocks, you should ensure that all transactions access the `Orders`, `Customers`, and `Products` tables in the same order. This can be achieved by modifying the application code to always lock these tables in the same order.