Fixed a bug where MySQL insertion was slow
(cherry picked from commit 32fae38)