You have a SQL Server 2012 instance named SQL\Instance1. Instance1 contains a
database named Database1.
You need to recommend an index defragmentation solution for an index named
ContentIndex. ContentIndex must meet the following requirements:
Remain online during the defragmentation.
Update distribution statistics.
Perform defragmentation as quickly as possible.
Which type of index defragmentation solution should you include in the recommendation?
More than one answer choice may achieve the goal. Select the BEST answer.
A.
DBCC DBREINDEX
B.
REORGANIZE
C.
REBUILD
D.
DBCC INDEXDEFRAG
C
statistics are not updated when reorganize is used
https://www.mssqltips.com/sqlservertip/2268/sql-server-fragmentation-how-to-address-it-part-8-of-9/
I think that D is correct
Unlike DBCC DBREINDEX or the index building operation generally, DBCC INDEXDEFRAG is an online operation.
I agree that DBCC INDEXDEFRAG is an online operation, but I don’t think it updates statistics. On this question, I’d go with answer C.
You are right!
The query optimizer does not update statistics after DBCC INDEXDEFRAG or ALTER INDEX REORGANIZE operations.
https://msdn.microsoft.com/pl-pl/library/ms190397%28v=sql.110%29.aspx
C wins 🙂 REBUILD
C and A are incorrect. Both run offline. The question states for online.
REBUILD WITH ONLINE = ON
https://msdn.microsoft.com/library/ms188388(v=sql.110).aspx
Seems C is correct
Wrong you can do Online operation with rebuild 🙂
c, work offline and add for reorganize
STATISTICS_NORECOMPUTE = { ON | OFF }
Specifies whether distribution statistics are recomputed. The default is OFF.
ON
Out-of-date statistics are not automatically recomputed.
OFF
Automatic statistics updating are enabled.
To restore automatic statistics updating, set the STATISTICS_NORECOMPUTE to OFF, or execute UPDATE STATISTICS without the NORECOMPUTE clause.
B.
REORGANIZE
– Online operation
– STATISTICS_NORECOMPUTE default OFF, so automatic statistics updating are enabled.
DBCC INDEXDEFRAG online operation too, but:
“This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. Use ALTER INDEX instead.”
STATISTICS_NORECOMPUTE does not work for reorganise