Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Update Stats and Rebuild Indexes in Azure Geo-Replicated Database

I have a Geo-Replicated Azure SQL Database which has some serious index fragmentation and outdated statistics.

An attempt to REORGANIZE or REBUILD an index, or to UPDATE STATISTICS results in the message "Failed to update database xxx because the database is read-only." however a quick check against sys.databases shows that the database is in fact not in READ_ONLY mode.

Understandably Azure manages the database as it is a geo-replicated copy, so my question is that if I request that Indexes and Statistics updates are implemented on the MASTER copy, whether my replicated copy will receive same, or is there a way to update on my replicated copy alone?

like image 749
WilliamR Avatar asked Oct 16 '25 15:10

WilliamR


1 Answers

All statements you run on the primary database to rebuild indexes and maintain statistics will also be executed on the secondary. For more information click here.

like image 78
Alberto Morillo Avatar answered Oct 18 '25 08:10

Alberto Morillo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!