Subject | slow inserts, no chaching ... |
---|---|
Author | prom_prometheus |
Post date | 2004-01-10T00:23:29Z |
hi,
i have to insert a lot of records from a dynamic array ..
how can i cache 1000 records p.e. and flush them to the server?
i use Dataset-components from IBO ...
my source is tooo slow:
if dmps.ebd.InTransaction then dmps.ebd.CloseTransactions;
dmps.ebd.autocommit:= false;
dmps.ebd.StartTransaction;
.......................
dmps.q_in ... is prepared before, q_in = TIBOQuery
"insert into xxxx (a, b, c, d) Values (:a, :b, :c, :d)" ..
dmps.prepare
dmps.ebd.commit;
.......................
dmps.ebd.StartTransaction;
...
repeat
ii:= 0;
repeat
inc(ii);
for x:= 0 to flist.count - 1 do begin
dmps.q_in.params[x].Value:= xdata[ii][x];
dmps.q_in.ExecSQL;
end;
until (ii = 1000);
dmps.ebd.commit; //-> here it should be written to db, but ..
dmps.ebd.StartTransaction;
until ....
................
it works without caching, 10 records per second, horrible ...
regards
gerhard
i have to insert a lot of records from a dynamic array ..
how can i cache 1000 records p.e. and flush them to the server?
i use Dataset-components from IBO ...
my source is tooo slow:
if dmps.ebd.InTransaction then dmps.ebd.CloseTransactions;
dmps.ebd.autocommit:= false;
dmps.ebd.StartTransaction;
.......................
dmps.q_in ... is prepared before, q_in = TIBOQuery
"insert into xxxx (a, b, c, d) Values (:a, :b, :c, :d)" ..
dmps.prepare
dmps.ebd.commit;
.......................
dmps.ebd.StartTransaction;
...
repeat
ii:= 0;
repeat
inc(ii);
for x:= 0 to flist.count - 1 do begin
dmps.q_in.params[x].Value:= xdata[ii][x];
dmps.q_in.ExecSQL;
end;
until (ii = 1000);
dmps.ebd.commit; //-> here it should be written to db, but ..
dmps.ebd.StartTransaction;
until ....
................
it works without caching, 10 records per second, horrible ...
regards
gerhard