Speed up insertions with transaction management