Ashish
Ashish

Reputation: 8529

Does MongoDB use statement-based and row-based replication like MySQL?

How does MongoDB replicate update query affecting multiple documents ?

Will it use statement based approach conserving op-log or row-based approach ?

What are the criteria to select row or statement based replication ?

Upvotes: 0

Views: 664

Answers (1)

Sammaye
Sammaye

Reputation: 43884

Will it use statement based approach conserving op-log or row-based approach

MongoDB works upon a row per row basis using an oplog. So when you do an update that effects multiple rows it will actually write each row one by one to the oplog, this is of course a space taker; as noted in the manual: http://docs.mongodb.org/manual/core/replication/#oplog

The oplog must translate multi-updates into individual operations, in order to maintain idempotency. This can use a great deal of oplog space without a corresponding increase in disk utilization.

The oplog is basically a capped collection and it will replicate going oldest first.

As far as I know MongoDB does not do statement based replication unlike many SQL techs can.

Upvotes: 3

Related Questions