Subject Re: [IBO] Big Batch...
Author Geoff Worboys
> 4+ minutes, 14K+ inserts.

Thats about 58 inserts/second. I can do better than that even
including a couple of blob fields.


> See anything here that could be tightened up?
>
> for i := 1 to tsl2.Count do
> begin
> dsql.SQL.Text := 'INSERT INTO SYMBOLS (SYMBOL) VALUES ('''
> + tsl2.Strings[i-1] + ''')';
> dsql.ExecSQL ;
> end;

As Jason pointed out, you are not using parameters. This means you
are forcing the statement to be prepared with every iteration! This
means big overheads, both at the server and the client. So something
like...

var
tmpCol: TIB_Column;
i: integer;
begin
dsql.SQL.Text := 'INSERT INTO SYMBOLS (SYMBOL)' +
' VALUES (:SYMBOL)';
dsql.Prepare;
tmpCol := dsql.ParamByName( 'SYMBOL' );
for i := 0 to tsl1.Count - 1 do
begin
tmpCol.AsString := tsl2.Strings[i];
dsql.ExecSQL;
// make the app responsive during long processing
if (i mod 1000) = 0 then
Application.ProcessMessages;
end;
end;

Remember to use tmpCol.Clear if you want to insert a NULL value as IBO
will not clear parameters between calls to ExecSQL.


> Again, when I tried to use multiple threads to speed this up,
> I get connection read or write errors.

The IB6 client has a bug and will not support multiple threads at this
time. (And besides which, even in IB5, you need to follow the
directions for multiple threading in IBO - see the sample
applications.)


> Will keep plugging away...

Try the above - or similar - and tell me how fast it is.


Geoff Worboys
Telesis Computing