Multithreaded database insertion