Skip to content

a quick study to better understand how to run a master slave read write replica

Notifications You must be signed in to change notification settings

macneib/sql-master-slave-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mysql master slave replication demo

SO notes:

You could also use a stored procedure. Consider the following table as an example:

CREATE TABLE your_table (id int NOT NULL PRIMARY KEY AUTO_INCREMENT, val int);

Then you could add a stored procedure like this:

DELIMITER $$
CREATE PROCEDURE prepare_data()
BEGIN
DECLARE i INT DEFAULT 100;

WHILE i < 100000 DO
INSERT INTO your_table (val) VALUES (i);
SET i = i + 1;
END WHILE;
END$$
DELIMITER ;

When you call it, you'll have 100k records:

CALL prepare_data();

Many thanks to Tarun Lalwani for his excellent blog post

About

a quick study to better understand how to run a master slave read write replica

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages