move access db in loop into background thread

access db in loop can be really time-consuming. why not move it into background thread?