title: How to speed up insertion from pandas.DataFrame .to_sql
body: <p>Hello i am currently trying to write data from four pandas data frame to mysql on my local machine , my machine is taking 32 seconds  for inserting  20,000 records (5000 for each table) Code-</p>
  
  <p>tables - 
  1) posts
  2) post_stats
  3) post_languages
  4) post_tags</p>
  
  <pre><code>engine = create_engine("mysql+mysqldb://root:dbase@123@localhost/testDb")
  
  startTime=time.time()
  
  dfstat.to_sql('post_stats', con=engine, if_exists='append', index=False)
  for i in range(0, dfp.shape[0]):
  ss = str(dfp.iloc[i][0])
  sss = 'Select id from post_stats where post_id =\"%s\"' % (ss)
  #print(sss)
  rss = engine.execute(sss)
  x = rss.fetchone()
  dfp['stats_id'][i] = x[0]
  dfp.to_sql('posts', con=engine, if_exists='append', index=False)
  dfl.to_sql('post_languages', con=engine, if_exists='append', index=False)
  dftagv.to_sql('post_tags', con=engine, if_exists='append', index=False)
  
  
  endTime=time.time()
  diff=endTime-startTime 
  print(diff)
  </code></pre>
  
  <p>Currenlty i am storing the data in my local machine but in future i have to send data over to mysql server , Is there any way to speed up insertion
  or is there any different approach so that i can store data at a faster rate like using bulk insert. please suggest</p>