Trial user: Firebird INSERT with IBDAC slower than IBX!?
Posted: Fri 23 Jan 2009 13:41
Hello,
I'm locking for new database components for Delphi2009, because Firebird isn't full supported by IBX.
At website I read: "IBDAC is x times faster than IBX"!
Ok, I loaded the trial version.
After converting a program with IBDAC-wizard I measured:
INSERT statement is 3 times slower than IBX-version
SELECT statement is not significant faster, nearly the same time.
You can try it out. Here is the IBX-sourcecode of my test program, run this, convert it to IBDAC, run a second time and compare the results...
My Questions:
I believe that IBDAC is faster than IBX. But where are my faults?
What to do to get a real fast database access?
After convert with wizard I had to change several lines at sourcecode from
to
manually.
Why the wizard don't did this work?
Thanks for your answer.
Frank
I'm locking for new database components for Delphi2009, because Firebird isn't full supported by IBX.
At website I read: "IBDAC is x times faster than IBX"!
Ok, I loaded the trial version.
After converting a program with IBDAC-wizard I measured:
INSERT statement is 3 times slower than IBX-version
SELECT statement is not significant faster, nearly the same time.
You can try it out. Here is the IBX-sourcecode of my test program, run this, convert it to IBDAC, run a second time and compare the results...
Code: Select all
procedure TForm2.Button1Click(Sender: TObject);
var
Tick : DWord;
AnzWerte,I,ID,Anz : integer;
PN : string;
begin
Memo1.Lines.Clear;
With DataModule do
begin
//open DB
Tick := GetTickCount;
IBDatabase1.Connected := True;
Memo1.Lines.Add('duration OpenDatabase: '+inttostr(GetTickCount-Tick));
//create table
Tick := GetTickCount;
IBTransaction1.StartTransaction;
IBSQL1.SQL.Text := 'CREATE TABLE FRANKS_TESTTABELLE (ID INTEGER NOT NULL, PATGRUPPE INTEGER DEFAULT 0 NOT NULL, PATNAME VARCHAR(100) DEFAULT '''' NOT NULL);';
IBSQL1.ExecQuery;
IBSQL1.SQL.Text := 'ALTER TABLE FRANKS_TESTTABELLE ADD PRIMARY KEY (ID)';
IBSQL1.ExecQuery;
IBTransaction1.Commit;
Memo1.Lines.Add('duration CREATE TABLE: '+inttostr(GetTickCount-Tick));
//fill table
AnzWerte := StrToInt(EAnzWerte.Text);//default set to 2000
Tick := GetTickCount;
IBTransaction1.StartTransaction;
for I := 0 to AnzWerte - 1 do
begin
IBSQL1.SQL.Text := 'INSERT INTO FRANKS_TESTTABELLE (ID, PATGRUPPE, PATNAME) VALUES (:ID, :PATGRUPPE, :PATNAME);';
IBSQL1.ParamByName('ID').AsInteger := I;
IBSQL1.ParamByName('PATGRUPPE').AsInteger := random(20);
IBSQL1.ParamByName('PATNAME').AsString := inttostr(random($FFFF))+inttostr(random($FFFF))+inttostr(random($FFFF));//just any text
IBSQL1.ExecQuery;
end;
IBTransaction1.Commit;
Memo1.Lines.Add('duration INSERT: '+inttostr(GetTickCount-Tick));
//load data
Tick := GetTickCount;
IBTransaction1.StartTransaction;
for I := 0 to AnzWerte - 1 do
begin
IBQuery1.SQL.Text := 'SELECT ID, PATNAME from FRANKS_TESTTABELLE where PATGRUPPE=:PATGRUPPE;';
IBQuery1.ParamByName('PATGRUPPE').AsInteger := random(20);
IBQuery1.Open;
while not IBQuery1.EOF do
begin
ID := IBQuery1.FieldByName('ID').AsInteger;
PN := IBQuery1.FieldByName('PATNAME').AsString;
Anz := ID+length(PN);//if I don't use ID and PN the compiler drops the FieldByName-statements
if Anz<0 then
ShowMessage('impossibel!');
IBQuery1.Next;
end;
end;
IBTransaction1.Commit;
Memo1.Lines.Add('duration SELECT: '+inttostr(GetTickCount-Tick));
//drop table
Tick := GetTickCount;
IBTransaction1.StartTransaction;
IBSQL1.SQL.Text := 'DROP TABLE FRANKS_TESTTABELLE;';
IBSQL1.ExecQuery;
IBTransaction1.Commit;
Memo1.Lines.Add('duration DROP TABLE: '+inttostr(GetTickCount-Tick));
//close database
IBDatabase1.Connected := False;
Memo1.Lines.Add('duration CloseDatabase: '+inttostr(GetTickCount-Tick));
end;//with DataModule
end;
I believe that IBDAC is faster than IBX. But where are my faults?
What to do to get a real fast database access?
After convert with wizard I had to change several lines at sourcecode from
Code: Select all
IBSQL1.ExecQuery;
Code: Select all
IBSQL1.ExecSQL;
Why the wizard don't did this work?
Thanks for your answer.
Frank