exam questions

Exam 70-762 All Questions

View all questions & answers for the 70-762 exam

Exam 70-762 topic 1 question 120 discussion

Actual exam question from Microsoft's 70-762
Question #: 120
Topic #: 1
[All 70-762 Questions]

You have a nonpartitioned table that has a single dimension. The table is named dim.Products.Projections.
The table is queried frequently by several line-of-business applications. The data is updated frequently throughout the day by two processes.
Users report that when they query data from dim.Products.Projections, the responses are slower than expected. The issue occurs when a large number of rows are being updated.
You need to prevent the updates from slowing down the queries.
What should you do?

  • A. Use the NOLOCK option.
  • B. Execute the DBCC UPDATEUSAGE statement.
  • C. Use the max worker threads option.
  • D. Use a table-valued parameter.
  • E. Set SET ALLOW_SNAPSHOT_ISOLATION to ON.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
The NOLOCK hint allows SQL to read data from tables by ignoring any locks and therefore not being blocked by other processes.
This can improve query performance, but also introduces the possibility of dirty reads.
References:
https://www.mssqltips.com/sqlservertip/2470/understanding-the-sql-server-nolock-hint/

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Kuratko
Highly Voted 5 years, 2 months ago
HOW about "E" -> enable snapshot; no dirty reads, etc. ?
upvoted 6 times
JohnFan
5 years, 2 months ago
If you access global temp tables within a transaction set to SNAPSHOT isolation, you must first enable the ALLOW_SNAPSHOT_ISOLATION database option for tempdb. As an alternative, you can use a hint to change the isolation level for the statement.
upvoted 1 times
...
ARehman
4 years, 5 months ago
Focus on the Statement carefully "You need to prevent the updates from slowing down the queries." it is clear that we need to deal with update process not with the Select Query. so in that case, E should be the best option. see detail below: Snapshot isolation avoids most locking and blocking by using row versioning. When data is modified, the committed versions of affected rows are copied to tempDB and given version numbers. This operation is called copy on write and is used for all inserts, updates and deletes using this technique. When another session reads the same data, the committed version of the data as of the time the reading transaction began is returned. Don't think too deep. there is no requirement/concerns of storage. so E is the best suited option.
upvoted 2 times
BabyBee
4 years, 3 months ago
Using the table hint will prevent the update process from blocking the select query, and it is also a Projections table so do not need to be 100% accurate.
upvoted 1 times
...
...
sunz_1
4 years, 3 months ago
NOLOCK is a select (only) hint
upvoted 1 times
...
...
Newt
Highly Voted 5 years ago
Just because you change Snapshot isolation to on does not mean it is being utilized. So "E" would only use more resources, but not prevent the locking. https://www.brentozar.com/archive/2013/01/implementing-snapshot-or-read-committed-snapshot-isolation-in-sql-server-a-guide/
upvoted 6 times
...
TrungMyLanTJ
Most Recent 4 years, 6 months ago
The table name is Projections, meaning not required high degree of accuracy NOLOCK is OK The answer is correct
upvoted 4 times
...
MML
4 years, 10 months ago
The NOLOCK and READUNCOMMITED hints are only allowed with SELECT statements. If we try to use this for an UPDATE, DELETE or INSERT we will get an error.
upvoted 3 times
MML
4 years, 10 months ago
But also I agree with Newt, SET ALLOW_SNAPSHOT_ISOLATION to ON is not enough, so the the most complete answer would be answer A.
upvoted 7 times
Braindripper
4 years, 3 months ago
i would not agree as its specificaly says to be used on updates. You cannot use this hint on updates. END. you can use the option E with extra steps to be used of course - but yes E its the answer.
upvoted 1 times
...
...
...
JohnFan
5 years, 2 months ago
Use the NOLOCK query hint if one of the transactions is a SELECT statement, but only use this method if the trade-off of a deadlock for dirty reads is acceptable. The use of the NOLOCK table hint is common in reporting applications against OLTP systems in which lack of consistency is a trade-off for faster query performance. However, when users are dissatisfied with inconsistent results, you can recommend removing this table hint and allow the default isolation in SQL Server to manage transaction isolation. Long write operations can block the report from executing. Similarly, if the report takes a long time to execute, the read operation can block write operations. Exclusive (X) This lock mode protects a resource during INSERT, UPDATE, or DELETE operations to prevent that resource from multiple concurrent changes. While the lock is held, no other transaction can read or modify the data, unless a statement uses the NOLOCK hint or a transaction runs under the read uncommitted isolation level. Rather than change the isolation level at the session level, you can force the read uncommitted isolation level by using the NOLOCK hint.
upvoted 1 times
als2kool
5 years, 2 months ago
The answer is clear it's just the question asks about fixing the updates, not fixing the queries so that part is confusing.
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago