Hi guys,
Primary platform is Sql2k14 SP2
Imagine the following situation:
The stats for a column in a table are out of sync in the secondary replica so when you execute some query gets a message like that:
Could not locate statistics '_WA_Sys_0000001F_200E7F64' in the system catalogs.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
You identifies _WA_Sys_0000001F_200E7F64 in sys.stats table and is it about, let's say"TABLEA"
select object_name(object_id),* from sys.stats
where [name] = '_WA_Sys_0000001F_200E7F64';
You compare both stats _WA_Sys_0000001F_200E7F64 in both replicas (writeable and readable)
and in the readable you see "Statistics for these columns were last updated (NEVER)". In the writeable is updated
After that you execute a REBUILD ALL against all the indexes on writeable replica.
Second later you can run the query without issues.
I am stuck with that. Let me explain:
I don't understand the relation between Indexes and Stats objects created for columns when none of my indexes inTABLEA were using the column affected by the object
stats _WA_Sys_0000001F_200E7F64
How can I refresh only the stats you want without rebuilding all the indexes?
What am I missing here?
Thanks for your explanations,
Enric