How to batch INSERT and UPDATE
Issue #233
on hold
how to use batch inserts with ORM and firedac ( for example postgresql),
is it possible
qryBatch.Params.ArraySize := StrToInt(edtArraySize.Text);
iTm := GetTickCount;
for i := 0 to qryBatch.Params.ArraySize - 1 do begin
qryBatch.Params[0].AsIntegers[i] := i;
qryBatch.Params[1].AsStrings[i] := 'string' + IntToStr(i);
end;
Execute(qryBatch.Params.ArraySize);
iTm := GetTickCount - iTm;
in my test this code 200 times faster at 10,000 entries
thanks for answer
Comments (7)
-
repo owner -
repo owner - changed version to 1.2 (develop)
- marked as enhancement
- marked as major
- changed component to Persistence
-
repo owner - changed milestone to Future version
-
repo owner - changed status to open
-
repo owner - changed version to 1.2
-
repo owner - removed milestone
Removing milestone: Future version (automated comment)
-
repo owner - changed status to on hold
As already announced further development regarding new features and fixing non trivial bugs or design issues of the ORM will be put on hold.
- Log in to comment
Not supported because the ORM is agnostic of what the data access components support (Array DML is a FireDAC feature) and currently does not support batch operations at all.
If you look at TSession.InsertList for example you see that it does DoInsert for each item in the list.