Subject Re: [ib-support] Re: Writing data in tables!
Author Lucas Franzen
Just some notes:

1. Application->ProcessMessages will use most of the time, you need.
2. If you want to insert just some data like these, write a stored
procedure like:

create procedure sp_insert_rows ( Start INTEGER, no_rec INTEGER )
as
declare variable i INTEGER;
declare variable X VARCHAR(12);
begin

i = 1;
while ( i <= no_rec ) do
begin
X = CAST ( ( i + start ) AS VARCHAR(12) );
INSERT INTO COUNTRIES VALUES ( :X, :X );
I = i + 1;
end

end;

Now you haven't got communication with your application, but you should
be able to insert 15000 records within some seconds.

Luc.




simpor81@... schrieb:
>
> Well the computer that I use is a Athlon800 and 256 RAM, and when I
> use the DSQL-component can I only make something like 1000 rows/sec???
>
> Maybe I'm using the wrong code or something like that.
>
> Here is the code anyway...
>
> IB_Transaction1->StartTransaction ();
> IB_Connection1->BeginBusy(true);
> IB_DSQL1->BeginBusy(true);
> IB_Transaction1->BeginBusy(true);
> IB_Transaction1->DisablePause ();
>
> for (int a = 0; a <= 5000; a++)
> {
> String aa = "INSERT INTO COUNTRY VALUES(" + IntToStr(a) + ", "
> + IntToStr(a) + ") ";
> IB_Transaction1->ExecuteImmediate(aa);
> this->Caption = IntToStr(a);
> Application->ProcessMessages ();
> }
>
> IB_Transaction1->Commit ();
> IB_DSQL1->EndBusy();
> IB_Connection1->EndBusy();
>
> IB_Transaction1->EndBusy();
> IB_Transaction1->EnablePause ();
>
> I must say thank you to all of you that have helped me so far. It's
> looks a bit brighter now actually. :) The program is a sort of
> simulator that needs to write 15000 rows and only the code with no
> writings to the database is taking 15 sec. The writing to the
> database is now taking 1:40 min + the 15 sec so almost 2 min.
>
> Is it possible to make Interbase run in the memory of a machine. From
> my knowledge is the writing to the harddrive the thing that takes the
> most time. So if you were able to put the hole database in the RAM
> then would it be really quick, wouldn't it.
>
> Just a little thought that I have had.
>
> Simon
> --- In ib-support@y..., "Kaputnik" <delphi@k...> wrote:
> > 15.000 inserts are not that big problem as you think.....
> >
> > With a fast machine (in my Case, Dual XEON with IB_Affinity, 6-LVD-
> disks in
> > RAID5, 2GB of RAM) and forced writes off I can go up to 12.000
> rows/sec
> > easily.
> > The trick is to disable all indizes prior to inserting and using a
> prepared
> > insert-statement with parameters.
> > With IBObjects and a DSQL-component, you will get these speeds. No
> need for
> > the API on this....
> >
> > On my home-machine, Athlon900 with IDE-raid and 768MB of Ram, I go
> up to
> > 6.000 insert per second. Note, that I have to generate the data for
> this in
> > realtime, so there is room for about another 20%, as the Interbase-
> service
> > is using roughly only 65-70% of the CPU.....
> >
> > Ah, yes, this was done on a local machine.....for remote
> connections, the
> > network is the limit, not Interbase.
> >
> > CU, Kaputnik
> > (Nick Josipovic)
> >
> > nick@k...
> > kap@k...
> > --------------------------------------------------------------------
> ---
> > superior Client/Server programming:
> > www.IBObjects.com
> > a nice Tool for Interbase:
> > www.InterbaseWorkbench.com
> > ----- Original Message -----
> > From: "Ali Gokcen" <alig@e...>
> > To: <ib-support@y...>
> > Sent: Monday, January 29, 2001 8:26 PM
> > Subject: Re: [ib-support] Re: Writing data in tables!
> >
> >
> > > 15,000 insert /second ?
> > > what about is this project ? stauroscope data? realtime image
> capturing ?
> > > you can't find any standart database system to do this.
> > > if your inserts need db for a few seconds immediatly, you can
> write them
> > > quickly to an external table file and transfer them in idle time.
> or use a
> > > special RAMDISK drive.
> > > i think using API will not improve the performance, insert
> components are
> > > allready lowest level.
> > >
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com