Improve db batch writing performance

Average batch write performance improvement of 40% on mysql dbs