Best Database For Ruby

B

Butternut squash

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.
 
R

Robert Klemme

Butternut said:
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.

As always, it depends on what you want to do. Postgres might be an
alternative - especially since it has proper transaction support, stored
procedures etc. significantly longer than MySQL.

Kind regards

robert
 
D

Daniel Harple

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.

I suggest using http://ruby-dbi.rubyforge.org to help keep your code
database-independent.

-- Daniel
 
G

Gerardo Santana Gómez Garrido

2006/3/25 said:
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 l= ong
time ago. It doesn't look like I can get this for linux.

You can download Informix for Linux from here:
http://www14.software.ibm.com/webapp/download/search.jsp?go=3Dy&rs=3Difxsee

and use it with Ruby with this:
http://ruby-informix.rubyforge.org

I'm running Informix on Solaris and Fedora Core 4 without any problem.

I've found Informix very nice.
 
R

Reid Thompson

Butternut said:
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
 
P

Pat Maddox

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 =3D {
:destroy =3D> false,
:store =3D> :psql,
:user =3D> 'rthompso',
:password =3D> 'rthompso',
:name =3D> 'testog'
}

Og.setup(og_psql)

puts Time.now
# save the object in the database
1.upto(10000) { |i|
c =3D Comment.new
c.title =3D 'Hello'
c.body =3D 'World'
c.create_time =3D Time.now
c.author =3D '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.
 
R

Reid Thompson

Pat said:
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
 
T

Tom Allison

I think the debate between Postgres and MySQL is about as inflammatory as vi and
emacs. However I'm of the opinion that Postgres is ultimately a better database
if you are going to do real database things where the data is changing
frequently (INSERT, UPDATE, DELETE) as opposed to just reading it.

But I haven't any hard metric data to support any of this.

Unless there's something specifically ruby-esque to make the advantage clearer.

Postgres is nicely object oriented if you are into that sort of thing.
 
Z

zdennis

Butternut said:
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.

Alot of folks have already mentioned Postgresql. I hear there is iffy blob support if you use it
with ActiveRecord (and the rest of Rails). I can't say for Nitro/Og.

I use Mysql without any issue. It has served me well at work, at home and on the side.

Zach
 
A

ara.t.howard

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.

if your applications really need network connectivity the consider mysql or
postrgresql - if they do not it's madness not to use sqlite, which has great
ruby support.

regards.

-a
 
R

Reid Thompson

Reid said:
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...
 
J

James Britt

if your applications really need network connectivity the consider mysql or
postrgresql - if they do not it's madness not to use sqlite, which has
great
ruby support.

But will using sqlite help one trying to learn SQL?
 
A

ara.t.howard

But will using sqlite help one trying to learn SQL?

no one can help someone using sql, we can only watch in dismay and horror ;-)

seriously though - why not? all the bloody dbs have there own dialect - might
as well commit to either learning to learn them or to not and using dbi - in
either case sqlite fits in.

besides - i think a good hacker could learn the entire sqlite dialect in the
time it takes to install mysql and get authentication and networking running
properly. especially once we throw user 'www' into the mix ;-)

regards.

-a
 
R

Robert Dober

------=_Part_1951_13884682.1143354490015
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

l

But will using sqlite help one trying to learn SQL?


--
James Britt
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.30secondrule.com - Building Better Tools

SQLite (http://www.sqlite.org) has good SQL92 support (execeptions are
http://www.sqlite.org/omitted.html). I use sqlite frequently and I was
always amazed of its ease to use. As stated above there is no need to look
at MySQL or Postgre unless you really need their features - network support
comming into mind. They are great products, do not get me wrong, but they
are very probably much more than you need.
Now when it comes to learning you might use all of them and more of course =
(
e.g. Firebird which seeems quite nice too and has pretty good ANSI-SQL
support. http://firebird.sourceforge.net/)

Hope you find that helpfull.
Robert


--
Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein

------=_Part_1951_13884682.1143354490015--
 
S

Simon Kröger

Reid Thompson:
Upated athlon system to PostgreSQL 8.1.3
8.78-9.2 seconds...

As Ara said: "it's madness not to use sqlite" if you don't need the
networking capabilities of MySQL or whatever.

change DB to sqlite3:

-----------------------------------------------------------
require 'sqlite3'

File.delete("test.db") if File.exists?("test.db")
db = SQLite3::Database.new("test.db")
t1= Time.now

db.execute("CREATE TABLE comments (title, body, create_time, author)")

db.transaction do
1.upto(10000) do
db.execute("insert into comments values ('Hello', 'World', ?, 'tml'
)", Time.now)
end
end

puts Time.now - t1
------------------------------------------------------------
1.5 seconds

(Pentium M, 2.13GHz, 1GB RAM)

cheers

Simon
 
R

Reid Thompson

Simon said:
Reid Thompson:

=20

As Ara said: "it's madness not to use sqlite" if you don't need the
networking capabilities of MySQL or whatever.

change DB to sqlite3:

-----------------------------------------------------------
require 'sqlite3'

File.delete("test.db") if File.exists?("test.db")
db =3D SQLite3::Database.new("test.db")
t1=3D Time.now

db.execute("CREATE TABLE comments (title, body, create_time, author)")

db.transaction do
1.upto(10000) do
db.execute("insert into comments values ('Hello', 'World', ?, 'tml'
)", Time.now)
end
end

puts Time.now - t1
------------------------------------------------------------
1.5 seconds

(Pentium M, 2.13GHz, 1GB RAM)

cheers

Simon



=20
agreed, if sqlite meets your needs, it would be the tool to use. IMO it=20
is an exceptional piece of software for what it is designed to do.
 
R

Rob Pitt

Being someone who has done a fair amount of development on Og, I can =20
tell you that this isn't just the database performance, the sqlite =20
adapter is leaner than the others since the project lead uses it and =20
the others definitely need a lot of optimization.

I can also tell you that having watched insert performance postgresql =20=

vs sqlite that postgresql usually beat it heavily on my machine, but =20
my machine was slower than yours.


agreed, if sqlite meets your needs, it would be the tool to use. =20
IMO it is an exceptional piece of software for what it is designed =20
to do.

Rob Pitt
Technical Architect

Motionpath Digital Media Ltd.
St Georges Road, Brighton, BN2 1ED.
Office: 01273 608708
 
D

Dave Howell

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.

Well, apparently you can, according to somebody else's post. However,
if that still doesn't appear to be a good choice, I'd also have to
recommend PostgreSQL over MySQL. I learned SQL on Microsoft SQLServer
6.5, and PostgreSQL generally acted a lot more like what I was
expecting than MySQL could. MySQL has grown a lot since I checked them
both out, but so has Postgres, and I still find Postgres's behavior to
be closer to what I've come to expect out of a "real" SQL relational
database. It's more paranoid about data integrity, for one thing, and
is willing to let me enforce very strict measures indeed.

The biggest nuisance is that outer joins use a very different syntax
than what I'm used to. {shrug}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,204
Messages
2,571,062
Members
47,669
Latest member
johnmaxwell

Latest Threads

Top