Fast way to insert 100k records to Firebird

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
flashfast
Posts: 1
Joined: Thu 06 Nov 2008 11:32

Fast way to insert 100k records to Firebird

Post by flashfast » Thu 06 Nov 2008 11:38

i'm using Unidac to connect to FireBird.

i want to import other data from text to Firebird database, about 100k records.

If use normal way it same too slow
i current using

for I := 0 to recordcount do
begin
UniQuery1.SQL.Text:= (sqlstr);
UniQuery1.Execute;
end;

Is there other way to do it faster .?

Thank

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 07 Nov 2008 11:28

Try to use a SQL statement with parameters:

Code: Select all

UniQuery1.SQL.Text := 'INSERT INTO Table1(a, b) VALUES (:a, :b)';
UniQuery1.ParamByName('a').DataType := ftInteger; 
UniQuery1.ParamByName('b').DataType := ftString;
UniQuery1.Prepare;
for I := 0 to recordcount do 
begin
  UniQuery1.ParamByName('a').Value := I; 
  UniQuery1.ParamByName('b').Value := I;
  UniQuery1.Execute;
end;
UniQuery1.Unprepare;

Post Reply