Transactional Replication Index and Statistics commands

Chaitanya Kiran 801 Reputation points
2022-12-01T20:55:22.313+00:00

Hi,
Transactional Replication replicates on transaction-by-transaction basis. Then, why CREATE INDEX statement and ALTER INDEX statements don't get replicated. Also, why UPDATE STATISTICS command gets replicated when index statements are not replicated

SQL Server Other
0 comments No comments
{count} votes

Accepted answer
  1. YufeiShao-msft 7,146 Reputation points
    2022-12-02T08:02:55.217+00:00

    Hi @Chaitanya Kiran

    Please check out this doc, it said adding, dropping, or altering indexes is not supported, it is not within the range of schema changes, this doc lists all DDL statements, for transactional replication, if the subscriber republishes data, the only supported schema changes are adding and dropping a column
    Make Schema Changes on Publication Databases

    An index is a schema object, but statistics is not, it is similar to other transaction log records

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2022-12-01T22:04:31.927+00:00

    I don't do much replication, but I believe whether to replicate index creation is an option on the publication.

    I guess the reason that index creation is not replicated by default is that you often want different indexes on the publisher (which may be an OLTP database) and the subscriber(s) (which may be used for reporting).


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.