Batch Inserts
For an event import, collect the records and submit them together instead of calling insert for each event. Use the table and EventLog mapping from Key Generation:
EventLog first = new EventLog();
first.setEventName("login");
EventLog second = new EventLog();
second.setEventName("logout");
lambda.insert(EventLog.class)
.applyEntity(first, second)
.executeSumResult();
String firstId = first.getId();
String secondId = second.getId();
With KeyType.UUID32, each event receives an application-generated ID before insertion. Without database-generated columns to retrieve, dbVisitor submits the inserts through JDBC batch.
Note
This groups the writes, but does not add an all-or-nothing transaction. If the call fails, check what was stored before retrying; repeated IDs are not rejected by MergeTree. See Duplicate Records.