java - How to prevent slowing down when populating a table? -


i populating table text file stored on machine. there around million records end of this, it's slow populate, in fact took 12 hours reach 140000 records. using while loop, extract needed information each record, call function:

 public void populatedb(int pid, string id, string title, string yearpublished, string author, string summary) {      papers p = new papers();     p.setpid(pid);     p.setpaperid(id);     p.settitle(title);     p.setyearpublished(yearpublished);     p.setauthor(author);     p.setsummary(summary);     em.persist(p);     em.flush();     system.out.println("populated paper " + id);  } 

but slows down number of iterations increases. think has cpu usage, seems limited 50%. don't know how increase this. max , min threadpool set 10. how can stop slowing down?

glassfish 3.1.2.2 enter image description here

having flush in loop not going good, , commits going important. factor consider indexes have on table. possible drop them whilst import? maybe @ batch insert in

http://viralpatel.net/blogs/batch-insert-in-java-jdbc/


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -