[Nitro] Idea for improving performance

George Moschovitis george.moschovitis at gmail.com
Wed Nov 23 04:05:20 EST 2005


Og allows you to do both:

u = User.find_by_name('gmosx')
u.password = hello
u.save # => updates the full row.


u = User.find_by_name('gmosx')
u.password = hello
u.age = 3
u.update_properties :password, :age # => only updates the selected fields

Some other tricks:

User.update('@hits = @hits + 1', :condition => 'oid = 1')
user.update_by_sql '@hits = @hits + 1'


Suit yourself ;-)

-g.




On 11/22/05, Reid Thompson <reid.thompson at ateb.com> wrote:
> Sam Smoot wrote:
>
> > It doesn't mark it for Deletion in the SQL sense. A better way to
> > describe it might be that it's marked for GarbageCollection. Either
> > way an Update query combines the existing tuple with the new data. IOW
> > you don't need to submit the full tuple.
> >
> > This idea for improving performance is actually very sound, and
> > implemented by "most" major O/R Mappers around. It's called a
> > UnitOfWork (http://www.martinfowler.com/eaaCatalog/unitOfWork.html).
>
>
> So what is being stated is that currently Og( or an underlying layer ),
> given a table with Columns N-P, when asked to perform an update
> affecting only P, generates SQL along the lines of '... update
> table_blah set N=Nold, M=Mold, O=Oold, P=Pnew ...' instead of '...
> update table_blah set P=Pnew ...'
>
> and that given the above is true, that by using the second form, we know
> that Og ( and/or underlying layers ) will perform faster by not having
> to handle the non-changing values
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>


--
http://www.gmosx.com
http://www.navel.gr
http://www.nitrohq.com




More information about the Nitro-general mailing list