I am importing some data from a 10Gb file to a postgres database tables using java (jdbc). Import process taking more 12 hours to complete, so need to improve the importing process. I tried copy command for inserting. Some select commands are also running with the inserting tables. Can anyone suggests the way to improve the speed?
Share
Standard SQL
INSERTstatement typically has a too big overhead when millions of rows are needed. 10 GiB of data isn’t really that much, but certainly too much forINSERT(you either have a huge transaction or commit/rollback every INSERT).There is a nice 14.4. Populating a Database chapter in official documentation. 14.4.2. Use
COPYis especially interesting for you:See also: