views:

71

answers:

1

I've been told that defragging causes the log to grow tremendously. Is this true? If so, is there something better to do than defragging that will not impact the log as much? We are running SQL Server 2005 replicating between 2 sites.

+3  A: 

There is no 'defrag' in SQL Server. You may be talking about an index reorganize operation or an index rebuild operation. Reorganize is light on log, but index rebuild creates as much log as the size of the index multiplied by a factor. For a large index the rebuild operation may result in log growth.

Having a large log will impact the transactional log reader agent simply because it will have more log records to scan through for a period. Eventually the log reader agent will catch up. The exact numbers (duration of latency, latency size etc) will differ based on a number of factors, your best choice is trial and measurement.

As for alternatives:

  • Did you measure the index fragmentation factor?
  • Do you have evidence that performance is affected by fragmentation? Many loads don't care about fragmentation.
  • Did you analyze the root cause of schema design that leads fragmentation?

If the answers are Yes, Yes and Yes and the conclusion is that periodic index rebuild is unavoidable then there is no alternative, you're going to have to bite the bullet and take this operation into account when calibrating the hardware requirements.

Remus Rusanu
Are the actual row "moves" replicated too?
gbn
@gbn: no. replication needs to replicate the data *changes* only, and a rebuild does not change any data.
Remus Rusanu
Some DDL are replicated too, but as a DDL operation, not as individual steps of the operation. Eg. adding a column is replicated, but this is done by running ALTER TABLE on the subscriber. Afaik. index maintenance operations are not replicated, since the subscriber is often differently organized (different filegroups, physical layout etc).
Remus Rusanu
I know some DDL is replicated, but I wondered about the ALTER INDEX thing. Cheers.
gbn