If we have a replication architecture and we are using stored procedures, we need to pay attention to the use of rand() inside the SPs.
Usually, single queries replicates correctly rand() values. MySQL writes to binlog the random number seed. You can consider the function execution timestamp and random number seed as implicit inputs that are identical on the master and slave.
You can see that below
mysql> create table prova(a double); Query OK, 0 rows affected (0.01 sec)
mysql> insert into prova values(rand()); Query OK, 1 row affected (0.00 sec)
mysql> show binlog events in 'mysql-bin.000035' from 865G *************************** 1. row *************************** Log_name: mysql-bin.000035 Pos: 865 Event_type: Query Server_id: 1 End_log_pos: 957 Info: use `prova`; create table prova(a double) *************************** 2. row *************************** Log_name: …[Read more]