split mysql inserts on large datasets

Patch from überwinter /Stefan Leuchsenring