I'm using geogig to import/export data from/to Oracle. As I was a bit surprised by the slowness of the export operation, I've looked a bit at how it's done.
Basically, in JDBCDataStore#insert, Geotools loops over the features to insert and, for every feature, will do that:
- Do a "select max(key)+1 from table" to get the next value to use
- Create a PreparedStatement with bound variables
- execute it
- close the PreparedStatement
That is very inefficient.
When doing a lot of inserts in JDBC, one should use addBatch and executeBatch.