[Nitro] OG vs Active Record

Trans transfire at gmail.com
Sun Aug 19 13:59:08 EDT 2007

On Aug 16, 7:49 pm, "Mark Van De Vyver" <mvy... at gmail.com> wrote:
> Hi,
> Thanks for all the effort that has gone into making Nitro/OG available.
> I'm relatively new to Ruby and am trying to decide between diving into
> ActiveRecord and OG.... I'd appreciate any advice.
> The useage case/scenario is:  Single 'amateur' developer, large
> numbers of databases, large databases (10'sGB/table, 10's tables/DB),
> multiple ruby scripts accessing the dbserver directly (no web
> interface - at this stage.)
> I understand that this is a little like asking a parent if their child
> is beautiful, but was hoping for some frank feedback on the following.
> 1) Am I right that OG largely overcomes the issues discussed in this
> (long) AR thread (I summarize a key issue below):http://rubyurl.com/xWb
> and here:http://aralbalkan.com/764
> A summary of a key AR issue (for me) is:
> <quote>
> Whether its in migrations or in the DB schema, I have to specify all
> the columns as well as their lengths and unique constraints to have
> the database created.  Then I have to specify the validates_* rules
> in the model to match.  Finally I have to keep both of them in sync
> over time.
> Why not do it all inside the model and have that set up all the
> validates_* rules in a single step?
> </quote>
> 2) Has anyone compared the performance of AR vs OG. The following
> thread about AR's cpu useage, surprised me:http://rubyurl.com/vFz
> I see the same performance on my system (script attached).  Has anyone
> run this test under OG?
> 3) How well is MySQL supported (bearing in mind that OG is at 0.5), or
> is most development done with Postgresql?  On MySQL, how about the
> MyISAM and Memory Engine/tables?

Objectively speaking. I would say Og is a better choice for ORM if you
are specifically NOT doing Rails development, but really it's a matter
of preference. The ActiveRecord model requires you to create the
Database first and foremost, Og starts with the model. While
ActiveRecord has model <-> db sync issues to manage, it's not usually
that bad. It's elaborate migration system helps a good bit. With Og
it's a lot easier, but you still have to deal with migrations, but
they aren't critical to functionality as with ARs and Og helps to make
it simple enough. However, FYI, there is a solution that makes
ActiveRecord easier to use by more intelligently using DB metadata:
http://magicmodels.rubyforge.org/. So there are options.

I'm sure you know this too, but just in case there was any doubt:
While Og is part of Nitro, it can be used completely independently.
I've actually been trying to convince George to free Og form the Nitro
repo for a while now! ;-)

Finally I should mention, if speed is your number one criteria, you
may want to look as DBI too. DBI is a straight forward adapter system
which simply allows you to work with the database directly in SQL. No
"magic" conveniences, but also no meta-code to slow anything down.


More information about the Nitro-general mailing list