[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Slow insertion




----- Original Message ----- 
From: "Falko Braeutigam" <falko@smb-tec.com>
To: "Trelio" <trelio@gmx.co.uk>; "Trelio" <trelio@gmx.co.uk>; <ozone-users@ozone-db.org>
Sent: Wednesday, May 09, 2001 11:00 PM
Subject: Re: Slow insertion


> On Tue, 08 May 2001, Trelio wrote:
> > At first it seems cool to use.
> > I take one of those examples,
> > more precisely, that that comes
> > with the tutorial, and try to
> > insert 1000 records doing a loop,
> > just like this:
> > 
> > ...snip...
> >          } else if (args[0].equals( "add" )) {
> >             Garage garage = (Garage)(db.objectForName( "my_garage" ));
> >             if (garage != null) {
> >                 int i = 1000;
> >                 while (i-- >= 0) {
> >                     garage.addCar_update( "EuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFuscaEuAdoroOMeuFuscaPorqueEleMeLevaAondeQueroQuandoQueroENuncaReclamaPorIssoEuNaoEnchoOTanqueDeGasolinaDoMeuFusca" + Math.random()*100000 , (int)Math.round(((Math.random()*10000) -1)));
> >                 };
> >             } else {
> >                 System.out.println( "Garage object not found!" );
> >             }
> > ...snip...
> > 
> > For my surprise, I find it slow.
> > I didn't time it. I just saw it.
> > When it finally finish, I try to
> > retrieve the records and they come
> > very fast.
> > 
> > Is it so slow for insertions ?
> > Is there something that I can
> > do to speed it up ?
> 
> Please read the documentation at http://ozone-db.org/documentation_main.html.
> It's not that much but the user documentation describes why business logic
> (like your for-loop) should be placed inside a method of a database class
> instead of placing them on the client, where each method call is a network
> roundtrip to the server. The ozone model is very comparable to the EJB model (
> where you use server side session beans for business logic) in this regard.
> 
> 
> Falko
> -- 

But if we does have this requirement, for example, on client side we have an grid to edit(
insert,remove,update) the garage.At last , we should post all these cars to ozone.The most
obvious way for that is to do like above code sinpper.
Or should we create an method in garage like "insert(collection)",and pass an collection 
parameter to the server side?
I think this situation also happened in RDBMS, when we start an transcation , then iterate over
an collection to do insert ,finaly, we commit the transcation.That's slow too, but we can controll
transaction,now we cannot manipulate transaction boundary.Should ozone support these features?