patternsqlMinor
Statistics for AlwaysOn Availability DBs
Viewed 0 times
dbsstatisticsforavailabilityalwayson
Problem
Can you please help me understand why there is a need for SQL Server to maintain statistics in tempdb for DBs that are part of an Always On Availability Group?
Isn't "everything" that happens in the Primary replica, replicated to the Secondaries? If so, statistics changes that happen in Primary would be replicated into secondary isn't it?
Isn't "everything" that happens in the Primary replica, replicated to the Secondaries? If so, statistics changes that happen in Primary would be replicated into secondary isn't it?
Solution
Isn't "everything" that happens in Primary replica, replicated to the Secondaries? If so, statistics changes that happen in Primary would be replicated into secondary isn't it?
You are correct.
Can you please help me understand why there is a need for SQL Server to maintain statistics for DBs that are part of Always On availability group in tempdb?
This really comes into play when there are secondary replicas which are readable. A readable secondary replica may have a workload on it that is different than the primary and could benefit from different statistics on the columns and indexes. This is where the temporary statistics in TempDB come into play (because the database is [for all outside purposes] readonly).
These statistics are really just to support differentiating workloads on a readable secondary without having to explicitly create them on the primary and let them flow through.
If readable secondary replicas aren't used, these will be of no use to you and won't even be created.
You are correct.
Can you please help me understand why there is a need for SQL Server to maintain statistics for DBs that are part of Always On availability group in tempdb?
This really comes into play when there are secondary replicas which are readable. A readable secondary replica may have a workload on it that is different than the primary and could benefit from different statistics on the columns and indexes. This is where the temporary statistics in TempDB come into play (because the database is [for all outside purposes] readonly).
These statistics are really just to support differentiating workloads on a readable secondary without having to explicitly create them on the primary and let them flow through.
If readable secondary replicas aren't used, these will be of no use to you and won't even be created.
Context
StackExchange Database Administrators Q#137867, answer score: 3
Revisions (0)
No revisions yet.