Re: [web2py] .update_or_insert not optimized!!
Sorry! On Wed, May 2, 2012 at 6:59 PM, Anthony wrote: > He's using update_or_insert, not validate_and_update, so no validation > involved. > > Anthony > > > On Wednesday, May 2, 2012 5:43:43 PM UTC-4, rochacbruno wrote: >> >> obviously it will take more time, and the time depend on the validators >> you are using and the total of fields you are updating. >> >> Do you have custom validators? (share the code) >> Of the built in validators, which you are using? how? >> >> Validating is a pre-processing and of course it will take some more time. >> >> On Wed, May 2, 2012 at 6:19 PM, puercoespin > **com > wrote: >> >>> In my app, .update_or_insert takes more time that code by hand. >>> >>> In a database with 5 tables and 60.000 records in total, the execution >>> time was: >>> >>> without .update_or_insert: 0 minutes. 48 secons (Code) >>> >>> >>> if combustible == G95: >>> row=db(db.G95.LongitudLatitud=** >>> =LongitudLatitud).select().**first() >>> if row: >>> row.update_record(Precio=**float(Precio),Fecha_* >>> *Actualizacion=Fecha_**Actualizacion) >>> else: >>> db.G95.insert(Latitud=float(** >>> Latitud),Longitud=float(**Longitud),Gasolinera=** >>> Gasolinera,Precio=float(**Precio),Fecha_Actualizacion=** >>> Fecha_Actualizacion) >>> >>> with .update_or_insert: 1 minute, 53 secons. >>> >>> (Code) >>> >>> >>> if combustible == G95: >>> >>> db.G95.update_or_insert(db.**G95.LongitudLatitud==**LongitudLatitud, >>> LongitudLatitud=**LongitudLatitud,Latitud=float(** >>> Latitud),Longitud=float(**Longitud),Gasolinera=** >>> Gasolinera,Precio=float(**Precio),Fecha_Actualizacion=** >>> Fecha_Actualizacion) >>> >>> >>> What's your opinion? >>> >> >> >> >> -- >> >> Bruno Rocha >> [http://rochacbruno.com.br] >> >> -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] .update_or_insert not optimized!!
He's using update_or_insert, not validate_and_update, so no validation involved. Anthony On Wednesday, May 2, 2012 5:43:43 PM UTC-4, rochacbruno wrote: > > obviously it will take more time, and the time depend on the validators > you are using and the total of fields you are updating. > > Do you have custom validators? (share the code) > Of the built in validators, which you are using? how? > > Validating is a pre-processing and of course it will take some more time. > > On Wed, May 2, 2012 at 6:19 PM, puercoespin < > jzaragoza.puercoes...@gmail.com> wrote: > >> In my app, .update_or_insert takes more time that code by hand. >> >> In a database with 5 tables and 60.000 records in total, the execution >> time was: >> >> without .update_or_insert: 0 minutes. 48 secons (Code) >> >> >> if combustible == G95: >> >> row=db(db.G95.LongitudLatitud==LongitudLatitud).select().first() >> if row: >> >> row.update_record(Precio=float(Precio),Fecha_Actualizacion=Fecha_Actualizacion) >> else: >> >> db.G95.insert(Latitud=float(Latitud),Longitud=float(Longitud),Gasolinera=Gasolinera,Precio=float(Precio),Fecha_Actualizacion=Fecha_Actualizacion) >> >> with .update_or_insert: 1 minute, 53 secons. >> >> (Code) >> >> >> if combustible == G95: >> >> db.G95.update_or_insert(db.G95.LongitudLatitud==LongitudLatitud, >> LongitudLatitud=LongitudLatitud,Latitud=float(Latitud),Longitud=float(Longitud),Gasolinera=Gasolinera,Precio=float(Precio),Fecha_Actualizacion=Fecha_Actualizacion) >> >> >> What's your opinion? >> > > > > -- > > Bruno Rocha > [http://rochacbruno.com.br] > >
Re: [web2py] .update_or_insert not optimized!!
obviously it will take more time, and the time depend on the validators you are using and the total of fields you are updating. Do you have custom validators? (share the code) Of the built in validators, which you are using? how? Validating is a pre-processing and of course it will take some more time. On Wed, May 2, 2012 at 6:19 PM, puercoespin wrote: > In my app, .update_or_insert takes more time that code by hand. > > In a database with 5 tables and 60.000 records in total, the execution > time was: > > without .update_or_insert: 0 minutes. 48 secons (Code) > > > if combustible == G95: > > row=db(db.G95.LongitudLatitud==LongitudLatitud).select().first() > if row: > > row.update_record(Precio=float(Precio),Fecha_Actualizacion=Fecha_Actualizacion) > else: > > db.G95.insert(Latitud=float(Latitud),Longitud=float(Longitud),Gasolinera=Gasolinera,Precio=float(Precio),Fecha_Actualizacion=Fecha_Actualizacion) > > with .update_or_insert: 1 minute, 53 secons. > > (Code) > > > if combustible == G95: > > db.G95.update_or_insert(db.G95.LongitudLatitud==LongitudLatitud, > LongitudLatitud=LongitudLatitud,Latitud=float(Latitud),Longitud=float(Longitud),Gasolinera=Gasolinera,Precio=float(Precio),Fecha_Actualizacion=Fecha_Actualizacion) > > > What's your opinion? > -- Bruno Rocha [http://rochacbruno.com.br]