Recordset recordset_dlg =datasetVector.getRecordset(false,CursorType.DYNAMIC);
Recordset.BatchEditor batchEditor = recordset_dlg.getBatch();
//设置批量更新每次提交最大数
batchEditor.setMaxRecordCount(10240);
batchEditor.begin();
int count =recordset_dlg.getRecordCount();
StopWatch stopWatch=new StopWatch();
stopWatch.start();
for (int j = 0; j < count; j++) {
recordset_dlg.setFieldValue("dlgid", 666);
recordset_dlg.setFieldValue("vers", 777);
recordset_dlg.moveNext();
}
batchEditor.update();
stopWatch.stop();
System.out.println(stopWatch.getNanoTime());
recordset_dlg.dispose();
workspace.dispose();
数据库引擎:postgis
问题:for循环给每个记录设置值效率慢,平均1000条耗时30S这样,总记录在5W甚至十几W这样这样,有没有更效率的方式批量更新