title: one by one insert row from one table to another using PROCEDURE and INSERT...SELECT
body: <p>Suppose I have two tables <code>tbl1</code> and <code>bak_tbl1</code> these tables are almost identical in strucutre.</p>
  
  <p>I used to use <code>INSERT...SELECT</code> method to insert data from <code>tbl1</code> to <code>bak_tbl1</code> in bulk like this:</p>
  
  <pre><code>INSERT INTO tbl_customer_sales (id,card_number,customer_name,customer_phone)
  SELECT id,card_number,customer_name,customer_mobile FROM tbl_master_sales WHERE NOT EXISTS
  (SELECT 1 FROM tbl_customer_sales WHERE id=tbl_master_sales.id);
  </code></pre>
  
  <p>It worked fine with smaller batches of data, but it creates huge performance problems with millions of records.</p>
  
  <p>So I want to know method that is as simplest as INSERT...SELECT if possible but inserts row one by one to another backup table <code>tbl1</code> and doesn't insert at once in bulk, so that system doesn't hang and I can work around the database while the procedure is pushing row one by one to <code>tbl1</code>.</p>