comdb2
comdb2 copied to clipboard
Fix inefficiency in cdb2api for large insert transaction
This change fixes an inefficiency in cdb2api for large insert transactions: we traverse the entire list when appending last sql to the list of stmts of a txn (used by hasql to retry the txn). Change here just keeps a pointer to the end of the list for quick appending. This reduces to 1/3 the time for a txn with 50k insert stmts, ex:
time slow.cdb2sql adidb -f q.sql &> /dev/null
real 0m15.778s
time fast.cdb2sql adidb -f q.sql &> /dev/null
real 0m5.570s
Signed-off-by: Adi Zaimi [email protected]