Page 1 of 1

How to increase INSERT performance?

Posted: Sun 20 Jan 2013 16:55
by gaborboros
Hi,

I search a component set for replacement of UIB. I see IBDAC have good support, actively developed , multiplatform, Lazarus support,...
With my simple test case UIB speed is ~11100 INSERT/sec. IBDAC ~2630 INSERT/sec, with prepare ~6250 INSERT/sec. Any other trick than prepare?
I used Firebird 2.5.2 32bit embedded and last version of IBDAC.

My simple test case is:

Code: Select all

CREATE SEQUENCE SEQ_1;

CREATE TABLE TABLE1 (
    ID       BIGINT NOT NULL,
    FIELD1   SMALLINT,
    FIELD2   VARCHAR(30),
    FIELD3   SMALLINT
);

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  x:=10000;
  y:=10;
end;

 procedure IBDAC;
 var
   DB:TIBCConnection;
   TR:TIBCTransaction;
   SC:TIBCSQL;
   i,j:integer;

 begin
   DB:=TIBCConnection.Create(Self);
   DB.Options.Charset:='UTF8';
   DB.Options.UseUnicode:=True;
   DB.AutoCommit:=False;
   DB.Database:='MYDB';

   DB.UserName:='SYSDBA';
   DB.PassWord:='masterkey';

   TR:=TIBCTransaction.Create(Self);

   TR.IsolationLevel:=iblcustom;
   TR.DefaultConnection:=DB;
   TR.Params.Add('wait');
   TR.Params.Add('write');
   TR.Params.Add('read_committed');
   TR.Params.Add('no_rec_version');

   DB.DefaultTransaction:=TR;

   SC:=TIBCSQL.Create(Self);
   SC.Connection:=DB;
   SC.Transaction:=TR;

   SC.SQL.Add('INSERT INTO TABLE1 (');
   SC.SQL.Add('ID, FIELD1, FIELD2, FIELD3');
   SC.SQL.Add(') VALUES (');
   SC.SQL.Add('NEXT VALUE FOR SEQ_1, :IN_FIELD1, :IN_FIELD2, :IN_FIELD3');
   SC.SQL.Add(') RETURNING ID;');

   DB.Connected:=True;

   for i:=1 to x do
    begin
      TR.StartTransaction;
      SC.Prepare;
      for j:=1 to y do
       begin
         SC.ParamByName('IN_FIELD1').Value:=1;
         SC.ParamByName('IN_FIELD2').Value:=IntToStr(((i-1)*10)+j));
         SC.ParamByName('IN_FIELD3').Value:=1;
         SC.Execute;
       end;
      TR.Commit;
    end;
   DB.Connected:=False;
 end;
Gabor

Re: How to increase INSERT performance?

Posted: Mon 21 Jan 2013 10:50
by AndreyZ
Hello,

To increase performance, you should set the UseUnicode property to False. We had a similar request at http://forums.devart.com/viewtopic.php?f=24&t=18926 . Please read it, there we explained in details the performance problem connected with the UseUnicode property (at the second page).

Re: How to increase INSERT performance?

Posted: Mon 21 Jan 2013 11:40
by gaborboros
AndreyZ wrote:Hello,

To increase performance, you should set the UseUnicode property to False. We had a similar request at http://forums.devart.com/viewtopic.php?f=24&t=18926 . Please read it, there we explained in details the performance problem connected with the UseUnicode property (at the second page).
The speed is same with UseUnicode:=True and UseUnicode:=False. Any other idea?

Gabor

Re: How to increase INSERT performance?

Posted: Mon 21 Jan 2013 14:11
by AndreyZ
Thank you for the information. We have reproduced the problem and investigation of the problem is in progress. As soon as we have any results, we will let you know.

Re: How to increase INSERT performance?

Posted: Mon 21 Jan 2013 15:51
by gaborboros
AndreyZ wrote:Thank you for the information. We have reproduced the problem and investigation of the problem is in progress. As soon as we have any results, we will let you know.
Nice. Thank You for your support!

Re: How to increase INSERT performance?

Posted: Wed 27 Feb 2013 08:38
by gaborboros
AndreyZ wrote:Thank you for the information. We have reproduced the problem and investigation of the problem is in progress. As soon as we have any results, we will let you know.
Any news?

Gabor

Re: How to increase INSERT performance?

Posted: Fri 01 Mar 2013 09:15
by AndreyZ
We are still investigating this question. We will let you know as soon as we have any results.

Re: How to increase INSERT performance?

Posted: Fri 22 Nov 2013 08:55
by Bjarke_Moholt
I experience a similar problem. I see this thread has been passive for quite a while, is there any news on this?

Re: How to increase INSERT performance?

Posted: Tue 26 Nov 2013 10:08
by AndreyZ
We have made several changes in IBDAC which improve the overall performance. These changes will be included in the next IBDAC build.