0

I'm not familiar with Always On Availability Groups, but our company is using it to provide a read-only replica for our main production database so that certain users can report against it and generate ad-hoc queries.

Since this is read-only, I know that no modifications can be made to this database. However, I was wondering if it's ever necessary to rebuild indexes or regenerate statistics on a read replica like this? Or, does this happen automatically when the the source database has indexes rebuilt or statistics regenerated?

2

No, you don't need to rebuild indexes or update statistics. You can't do any writes to a readable replica at all.

3
  • You are correct about stats update is not possible, but one must also note that statistics on secondary replica can be stale or outdated for queries running on read only databases in that case information mentioned in This Blog can help
    – Shanky
    Jun 19 '17 at 12:55
  • This being the case, how do statistics get updated on a read replica? Hmm.. according to the article Shanky provided, I guess you can't. However, that article was from almost 6 years ago. Jun 19 '17 at 13:06
  • Stats get updated the same way data does - from the primary.
    – Brent Ozar
    Jun 19 '17 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.