Subject RE: [firebird-support] parrallel update
Author Svein Erling Tysvær
>**********************
>now i do in loop with one single thread, one connection :
>
>Start transaction
>insert Into Table_A(ID) VALUES('<#randomchar>'); //
>insert Into Table_A(ID) VALUES('<#randomchar>'); // (100 000 loop)
>insert Into Table_A(ID) VALUES('<#randomchar>'); //
>commit transaction
>
>average Insert time taken for each thread : 0.24 ms
>total time to insert 300 000 rec: 34.8 seconds
>
...
>now with 3 different Thread and 3 different connection
...
>average Insert time taken for each thread : 0.12 ms
>total time to insert 300 000 rec: 18.7 seconds
>
>so the parallel are 2 times more faster ! (i was hopping 3 times, but i do
>the test on a slow sata hard drive and a single processor computer that
>can explain)
>
>so at end the parrallel insert a much more faster (2x) than the
>sequential insert !

Changing the entire sql statement 100000 times like your example do takes a considerable amount of time. The easiest way for you to speed things up would be to use parameters, prepare once and execute 100000 times, i.e. something like (using IBO and Pascal since that is what I use):

TIB_DSQL1.SQL.Add('insert Into Table_A(ID) VALUES(:MyParam)');
TIB_DSQL1.Prepare;
for I:=1 to 100000 do
begin
TIB_DSQL1.Params[0].AsString:='<#randomchar>';
TIB_DSQL1.Execute;
end;

Or is this what you're already doing, just that your example was simplified?

HTH,
Set