Subject RE: [IBO] ib_query slow copy 300.000 records.
Author Svein Erling Tysvær
Generally, I'd say using a parameterised TIB_DSQL for import is superior to using TIB_Query. Also, try to avoid using ParamByName (or FieldByName) for your TIB_DSQL for each iteration, that will be very slow (I know nothing about TQuery). Committing for each 10000 sounds like a good idea. Here's a simple example that isn't checked in any way (and that doesn't include any commits):

var
MyValue1,
MyValue2: TIB_Column;
begin
TIB_DSQL1.sql.clear;
TIB_DSQL1.sql.ADD('INSERT INTO MyTable(MyField1, MyField2) VALUES (:MyValue1, :Myvalue2)');
TIB_DSQL1.Prepare;
MyValue1:=TIB_DSQL1.ParamByName('MyValue1');
MyValue2:=TIB_DSQL1.ParamByName('MyValue2');
tQuery1.Open;
while not tQuery1.eof do
begin
MyValue1.AsInteger:=tQuery1.Fields[0].AsInteger;
MyValue2.AsString:= tQuery1.Fields[1].AsString;
TIB_DSQL.Execute;
tQuery.Next;
end;
end;

Doing things this way ought to make your import considerably faster, I'd expect a few thousand inserts per second, but of course, lots of things matters for speed.

HTH,
Set

-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of send2iwan
Sent: 7. oktober 2009 09:43
To: IBObjects@yahoogroups.com
Subject: [IBO] ib_query slow copy 300.000 records.

hi all,

i am using TIB_Query for import data from dbf (300.000 records)

every 10000 i do hard commit, after 100.000 records looping go very slow.
for dbf i am using TQuery.

slow i mean for 300.000 records i spent 3 hours.
how to speed up?

please help, thanks.

Iwan