exam questions

Exam DP-300 All Questions

View all questions & answers for the DP-300 exam

Exam DP-300 topic 4 question 21 discussion

Actual exam question from Microsoft's DP-300
Question #: 21
Topic #: 4
[All DP-300 Questions]

HOTSPOT -
You have SQL Server on an Azure virtual machine.
You review the query plan shown in the following exhibit.

For each of the following statements, select yes if the statement is true. Otherwise, select no.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: No -
There is only one query plan available. Force has no effect.

Box 2: No -
Adding an index will not increase IO usage.

Box 3: Yes -
The performance would improve.
Reference:
https://docs.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store

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
miguelmol
Highly Voted 4 years ago
For me all the three are NO: 1.If you force that query plan, the behaviour will be always the same, so you will not reduce or increase the I/O compared with what we see in the image. Only in the case you see in the chart another and worst query plan used by the query, choosing this one will reduce the average I/O. 2.You can create another index in the table but if using it is worse than using the current one, the sql engine will not choose it in the plan. 3.PK is the clustered index and it has all columns by definition.
upvoted 33 times
learnazureportal
3 years, 2 months ago
You need to review execution plan carefully. The execution plan already complains for those keys. so we need to add within the PK to reduce execution cost!
upvoted 3 times
...
Luke97
3 years, 10 months ago
Agree. By definition a clustered index includes all columns. So there are none left to include. 3 is NO.
upvoted 5 times
...
Daba
2 years, 9 months ago
No-Yes-No New NC index with all required fields included will reduce the IO.
upvoted 4 times
...
Save
3 years, 6 months ago
Wrong: the clustered index and it has NOT all columns by definition. What does it meas HAS? Whatever index has Key column and NON-Key columns. Here we're talking to include columns in the Key (not in INCLUDE of course). So that it is possible, and this makes the index more covering than before.
upvoted 1 times
...
...
JohnCrawford
Highly Voted 3 years, 9 months ago
Answers are No, No and Yes. 1) force plan - there is only one execution plan. Forcing it will not change the run time. 2) No - adding another index can incur maintenance overhead, but it is not going to INCREASE the IO. If it did the optimizer would use the plan it already has. 3) Yes - Agreed with whomever said the extra columns should not be added to the primary key, but design is not the question. Question is will it make the plan more efficient. Yes it will. Currently we have a lookup. Adding those columns will make the index a covering index for this query and eliminate the lookup.
upvoted 30 times
vicky007_87
3 years, 9 months ago
I manually tested the query run on sample adventureworks DB and observed saving in Logical reads. logical reads reduced from 689 to 5 which confirms the correct answer for third part is Yes. (it may not be a good design decision but it does provide improved performance). Correct answer as per my analysis - No, No, Yes
upvoted 9 times
pr054
3 years, 3 months ago
Apparently you "added" the columns to the "PK", but did not "include" the columns to the "clustered index". The page reads were reduced because PK columns were cloned to nonclustered indexes internally. You may make another test with separated clustered index and PK, you would see what actually worked for you was the change with PK but not clustered index. And the exam question is no saying PK_SalesOrderHeader_... is actually a Primary Key though the name implies so.
upvoted 1 times
...
DrC
3 years, 8 months ago
You cant have included columns in a clustered index, all columns are "included"
upvoted 2 times
Save
3 years, 6 months ago
Wrong: all columns are NOT included. Include means that they have the value in index pages. This is not the case. On a Clustered Index there are only key columns; all the others are on data pages. So the third question is NO
upvoted 1 times
...
...
...
Behto
3 years, 1 month ago
3) is NO. Your argument suggests that the columns would be ADDED to the primary key, but the statement in the question talks about "INCLUDING" the columns in the primary key INDEX, not the primary key itself.
upvoted 1 times
...
...
Ben999
Most Recent 8 months, 2 weeks ago
No, Yes, No. - Issue can be resolved by modifying the existing non-clustered index making it a covering index, or creating a new non-clustered covering index. Making the clustered index a covering index does not make any sense.
upvoted 2 times
...
testdumps2017
1 year, 2 months ago
1. NO - self explanatory, only one plan present. 2. NO - query stats will improve if you create an index (you will see a decrease in the IO for the query). 3. NO - the question mentions PK_, while the print screen shows IX_.
upvoted 3 times
...
Cococo
1 year, 5 months ago
3rd point - interesting one, if you add these 3 columns to the Clustered Index (and you can do it, columns in clustered index are just changing the physical sorting order of all rows) execution plan likely will change to Clustered Index Scan. Estimated Number of rows is 1, Clustered Scan and Key Lookup, in that case, will be pretty much the same, because in both cases plan is looking for SalesPersonID first in a Clustered index and then scan all the filtered pages for needed data. I think the answer is NO, there will be no improvement in I/O.
upvoted 1 times
...
rosa_0617
3 years, 1 month ago
PK_....does that mean it's a primary key
upvoted 1 times
...
learnazureportal
3 years, 2 months ago
BTW, Provided Answer is correct.
upvoted 2 times
...
JohnAvlakiotis
3 years, 2 months ago
My take on this: - No, there is only 1 query plan makes no sense to force it in the current context - Yes, by creating a non-clustered index that includes the column in the output list would yield better results - No, you can not *include* columns in a PK only add columns to it, and it never makes sense to add this kind of columns to PK which is used for integrity reasons and not for querying reasons and perf.
upvoted 2 times
...
learnazureportal
3 years, 2 months ago
The provided answer is correct. the item #1 and Item #2 are general topics and the item #3, check execution plan, The execution plan already complains for those keys. so we need to add within the PK to reduce execution cost!
upvoted 1 times
...
Raffer
3 years, 7 months ago
No Forcing this plan will not reduce I/O or query execution time, as this is the only plan available. No A new index with 3 columns SalesPersonId (sole key column), subtotal & totaldue would reduce I/O and query execution time, as there would be fewer rows per 8k block, compared to using the shown nonclustered index + lookups to the clustered index. No Makes no sense, as can't add same columns to a clustered index (which always includes all table columns).
upvoted 3 times
...
fukaka
3 years, 7 months ago
For third, "include" may mean to ADD those additional columns into primary key as covering index, not using INCLUDE clause.
upvoted 2 times
...
nkav
3 years, 8 months ago
3rd option is NO. This is a clustered index. It would only be true if you created a non-clustered index.
upvoted 3 times
...
JohnCrawford
3 years, 9 months ago
@Phund...This pattern in an execution plan (lookup - either RID or straight lookup) means that there is no index that completely covers the query. For the purpose of this question if a covering index were created it would improve performance.
upvoted 4 times
...
Phund
3 years, 9 months ago
1.No: Just have only one Execution Plan, so force have no other plan to be forced 2.No: Add index increase IO at maintain time and creation time not at query time 3.No: Cluster Index have got all columns included
upvoted 7 times
vicky007_87
3 years, 9 months ago
I manually tested the query run on sample adventureworks DB and observed saving in Logical reads. logical reads reduced from 689 to 5 which confirms the correct answer for third part is Yes. (it may not be a good design decision but it does provide improved performance). Correct answer as per my analysis - No, No, Yes
upvoted 2 times
...
...
BurhanUddin
3 years, 9 months ago
so, what is the answer for this?
upvoted 1 times
...
John88
3 years, 11 months ago
Answers are correct as they make sense to the given conditions and questions.
upvoted 2 times
...
rux
3 years, 11 months ago
N. 1 NO: we have only a plan, doesn't make sense to force it N.2 NO: we already have e NCI on the table N.3 YES: this way you'll avoid the keylookup
upvoted 8 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