1
votes

I have recently successfully setup a Read Replica on Amazon RDS. Its all working well, although the Replica Lag seems to be substantial (often >60 secs). From monitoring the processes it seems that all UPDATE commands on the master/main DB are executed subsequently on the replica/slave.

This seems surprising since the system knows the number of affected rows (on master), so I was assuming that it did not pass on any queries which did not change anything. However, even these are executed on the slave.

Why is this and (how) can you stop this from happening?

1

1 Answers

2
votes

The identification of whether the query is relevant or irrelevant required little bit of intelligence; with that said, essential all the queries which affect / effect the MASTER is expected to hit the Read-Replica as well.

It would really difficult ( IMHO impossible ) to create a system to determine which query to be skipped from being sent from MASTER to Read-Replica because

UPDATE students SET SCORE = 100 WHERE student_id = 100may return 0 row(s) affected

and also TRUNCATE TABLE student will always return 0 row(s) affected

So, Bottom line all the queries which were handled by MASTER should be again dealt with Read-Replicas.