Best Database For Ruby

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.

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.

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

On Mar 25, 2006, at 11:48 PM, 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.

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

– Daniel

2006/3/25, Butternut squash [email protected]:

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.

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

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.

thanks in advance.


Gerardo S.
“Between individuals, as between nations, respect for the rights of
others is peace” - Don Benito Juárez

On 3/25/06, Reid T. [email protected] wrote:

property :author, String

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.

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 HugeDomains.com

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

Reid T. wrote:

Project is not too big. Probably need 30 tables
PostgreSQL www.postgresql.org
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.

Pat M. wrote:

gem install nitro -y

:user => ‘rthompso’,
c.title = ‘Hello’

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

On Sun, 26 Mar 2006, 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.

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

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.

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

Reid T. wrote:

Informix a long
gem install postgres-pr


:destroy => false,
1.upto(10000) { |i|

Different machine - athlon 2500, 512MB RAM, windows XP – postgresql

puts Time.now - t1

Upated athlon system to PostgreSQL 8.1.3
8.78-9.2 seconds…

[email protected] wrote:

On Sun, 26 Mar 2006, Butternut squash wrote:

I want to learn DB and SQL using Ruby

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?

On Sun, 26 Mar 2006, James B. wrote:

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?

no one can help someone using sql, we can only watch in dismay and
horror :wink:

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 :wink:

regards.

-a

On 3/26/06, James B. [email protected] wrote:

postrgresql - if they do not it’s madness not to use sqlite, which has
http://www.30secondrule.com - Building Better Tools

SQLite (http://www.sqlite.org) has good SQL92 support (execeptions are
SQL Features That SQLite Does Not Implement). 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êtise humaine ; en ce qui
concerne l’univers, je n’en ai pas acquis la certitude absolue.

  • Albert Einstein

Reid T.:

c.title = ‘Hello’

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

Tom A. [email protected] writes:

I think the debate between Postgres and MySQL is about as inflammatory
as vi and emacs.

Of course, the difference is that both vi and emacs are very good
editors…
scnr

Tom A. wrote:

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

Now, I don’t want to veer way off topic for either this thread or this
list, but I was wondering what brings you to say that? I’ve never
thought of any particular DB being more or less OO.

Recently, I investigated Postgres’ table inheritance feature, but found
it to be lacking in robustness. Constraints are not carried over to
child tables, and even if you redeclare them in child table definitions,
UNIQUE constraints are not enforced across the rows of both tables
(i.e., you can have a row with table1.id = 1 and a row with table2.id =
1).

To me, this makes it (inheritance, not Postgres as a whole) seem okay
for toy applications, but not for anything serious.

(For the record, I prefer Postgres, but only because at the time I made
my choice, MySQL was lacking in “serious” DB features.)

/me leaves it at that, not wanting to argue PG vs. MySQL

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

I can also tell you that having watched insert performance postgresql
vs sqlite that postgresql usually beat it heavily on my machine, but
my machine was slower than yours.

On 27 Mar 2006, at 18:23, Reid T. wrote:

t1= Time.now

As Ara said: “it’s madness not to use sqlite” if you don’t need the

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

Rob Pitt
Technical Architect

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

On Mar 25, 2006, at 14:48, 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.

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}

Simon Kröger wrote:

puts Time.now - t1

(Pentium M, 2.13GHz, 1GB RAM)

cheers

Simon

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