Manage and monitor SQL Server Instances Flashcards

1
Q

UPDATE STATISTICS with the SAMPLE xx PERCENT

A

This statement update statistics on a table or indexed view using a custom sampling. The percentage value represents the approximate percentage of rows that the query optimizer will use when it updates the statistics You can also express the custom sample with the number of rows using the SAMPLE xx ROWS option

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

UPDATE STATISTICS

A

using this command, the query optimizer dynamically calculates the sample value based on the table size and other parameters. This is the default behavior In this case, using the default sampling value makes the query optimizer use suboptimal query plans. That means that the number of selected rows for calculating the statistics is not meaningful enough for creating an optimal query plan.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

UPDATE STATISTICS with the FULL SCAN

A

This option uses all rows that a table
or indexed view needs to update the statistics This operation has big impact on performance. You should
consider it carefully before using this option in a large table. FULL SCAN and SAMPLE 100 PERCENT are
equivalent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

UPDATE STATISTICS with the RESAMPLE

A

This option updates the statistics using
the most recent sample rate. This option can also result in a full-table scam You cannot use custom sample
rates with this option.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Auto Update Statistics Asynchronously Option

A

This option is disabled by default When the query optimizer needs to compile a query plan, it checks the statistics of the related tables. If those statistics are outdated, the statistics are updated and the query optimizer waits for this update to complete before compiling the plan. If the Auto Update Statistics Asynchronously option is enabled, the query optimizer does not wait for the update to complete. Instead, it compiles and chooses a suboptimal query plan.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Auto Create Statistic

A

controls whether missing optimization statistics should be created. This option is enabled by default. The query optimizer needs the optimization statistics for compiling the query plan.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Auto Update Statistics

A

controls whether the database should automatically update those outdated optimization statistics. This option is enabled by default. The query optimizer needs the most recent optimization statistics for compiling the optimal query plan. There is an internal trigger that runs the update when the number of changed rows in a table is greater than 20 percent and more than 500 rows. This process runs during the optimization phase of a query, which means that only statistics that are needed by the query are updated.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The database Compatibility level

A

controls the latest version of SQL Server supported by the database. Although there are some statistics update features that change starting with compatibility level
130, those features have to do with the threshold for automatically updating the optimization statistics. This
is not the most probable cause for the query optimizer selecting suboptimal query plans.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

DBCC SHOWSTATS

A

This lets you view statistics information collected over time and is not limited to current statistics. It also runs from the context of a statistics object, a table, or an index, not a query.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

sys.dm_db_stats_properties

A

it lets you view statistics information collected over time and is not limited to current statistics. It also runs from the context of a statistics object, a table, or an index, not a query.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Auto Update Statistics Async

A

this option runs not during the query compilation phase, but when the server decides to update them. This approach might have a negative impact on server performance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

sp_updatestats

A

this will update the statistics only once. This procedure is also on the deprecated list. The UPDATE STATISTICS statement should be used instead for situations in which you need to update the statistics only once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly