From: Reid Thompson Date: 2006-03-26T14:38:39+09:00 Subject: Re: Best Database For Ruby Reid Thompson wrote: > Pat Maddox wrote: >> On 3/25/06, Reid Thompson wrote: >> >>> Butternut squash wrote: >>> >>>> I want to learn DB and SQL using Ruby >>>> >>>> Project is not too big. Probably need 30 tables >>>> >>>> Everyone at work tells me MySQL is the best... I used to use >>>> Informix a long >>>> time ago. It doesn't look like I can get this for linux. >>>> >>>> thanks in advance. >>>> >>>> >>>> >>> PostgreSQL www.postgresql.org >>> >>> #for ruby db interaction.... >>> gem install postgres >>> gem install postgres-pr >>> # http://nitrohq.com http://www.nitrohq.com/view/Og >>> gem install nitro -y >>> >>> >>> PostgreSQL and Og work very well... >>> >>> simple example -- playing around with ruby and postgresql on win XP.. >>> 10000 inserts in ~54 seconds ( pentium 4, 2+ghz, 1GB ram ) >>> >>> ogtest.rb >>> -------------------- >>> require 'og' >>> >>> class Comment >>> property :title, String >>> property :body, String >>> property :author, String >>> property :create_time, Time >>> end >>> >>> og_psql = { >>> :destroy => false, >>> :store => :psql, >>> :user => 'rthompso', >>> :password => 'rthompso', >>> :name => 'testog' >>> } >>> >>> Og.setup(og_psql) >>> >>> puts Time.now >>> # save the object in the database >>> 1.upto(10000) { |i| >>> c = Comment.new >>> c.title = 'Hello' >>> c.body = 'World' >>> c.create_time = Time.now >>> c.author = 'tml' >>> c.save >>> } >>> puts Time.now >>> >>> >>> >>> >>> >> >> I've never used og, but I suspect that'd drop to < 10s if you wrapped >> it all in a transaction. >> >> > yep - was just meant to show a simple usage with stats... but, since > i'm interested anyway... > > Different machine - athlon 2500, 512MB RAM, windows XP -- postgresql > 8.0.3 rather than PostgreSQL 8.1.3 and running ruby from cygwin rather > than natively.... > > Runs in 12-13 seconds -- entirely possible that the other box( p4, > 2+ghz, 1GB ram, native ruby ) could drop it down under 10 seconds( or > even this box, if I took cygwin out of the equation ). > > db =Og.setup(og_psql) > t1= Time.now > db.store.start > > 1.upto(10000) { |i| > c = Comment.new > c.title = 'Hello' > c.body = 'World' > c.create_time = Time.now > c.author = 'tml' > c.save > } > > db.store.commit > puts Time.now - t1 > > > Upated athlon system to PostgreSQL 8.1.3 8.78-9.2 seconds...