exam questions

Exam 70-764 All Questions

View all questions & answers for the 70-764 exam

Exam 70-764 topic 1 question 309 discussion

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

HOTSPOT -
You have a Microsoft SQL Server instance that hosts a database named DB1 that contains 800 gigabyte (GB) of data. The database is used 24 hours each day.
You implement indexes and set the value of the Auto Update Statistics option set to True.
Users report that queries take a long time to complete.
You need to identify tables that meet the following requirements:
✑ More than 1,000 rows have changed.
✑ The statistics have not been updated in over a week.
How should you complete the Transact-SQL statement?
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Example:
SELECT obj.name, obj.object_id, stat.name, stat.stats_id, last_updated, modification_counter

FROM sys.objects AS obj -
JOIN sys.stats stat ON stat.object_id = obj.object_id
CROSS APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp
WHERE modification_counter > 1000
order by modification_counter desc;
sys.sysindexes contains one row for each index and table in the current database. rowmodctr counts the total number of inserted, deleted, or updated rows since the last time statistics were updated for the table.
Example 2:

SELECT -
id AS [Table ID]
, OBJECT_NAME(id) AS [Table Name]
, name AS [Index Name]
, STATS_DATE(id, indid) AS [LastUpdated]
, rowmodctr AS [Rows Modified]

FROM sys.sysindexes -
WHERE STATS_DATE(id, indid)<=DATEADD(DAY,-1,GETDATE())
AND rowmodctr>10 AND (OBJECTPROPERTY(id,'IsUserTable'))=1
References: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/493b90e3-cdb8-4a16-8249-849ba0f82fcb/how-to-find-outdated-statistics-in-sql-server? forum=transactsql

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
MSSucks
Highly Voted 5 years, 2 months ago
STATS_DATE is a function and doesn't exist in either sys.objects nor sys.stats nor sys.tables. So there is no correct answer to this question. See question #52 for how STATS_DATE() is used.
upvoted 7 times
...
Anette
Most Recent 4 years, 6 months ago
there is no correct answer :/
upvoted 1 times
...
Slava_bcd81
4 years, 7 months ago
the info can be get from "sys.dm_db_stats_properties" table in the question query, but fields names are different
upvoted 2 times
...
tapsAch
4 years, 7 months ago
Question and Answer both seem wrong. Not a valid question
upvoted 2 times
tapsAch
4 years, 7 months ago
This is the correct answer: SELECTOBJECT_NAME(id),name,STATS_DATE(id, indid),rowmodctr FROM sys.sysindexesWHERE STATS_DATE (id, indid)<=DATEADD(DAY,-1,GETDATE()) AND rowmodctr>0 AND id IN (SELECT object_id FROM sys.tables) GO Ref: https://www.briefmenow.org/microsoft/how-should-you-complete-the-transact-sql-statement-15/
upvoted 2 times
...
...
TheSwedishGuy
5 years, 2 months ago
Get the stats from sys.objects (not sys.stats), then get the rowmodctr from sys.stats.
upvoted 1 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