Forum: Ruby Best Database For Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Butternut squash (Guest)
on 2006-03-26 00:49
(Received via mailing list)
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.
Robert K. (Guest)
on 2006-03-26 00:54
(Received via mailing list)
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
Daniel H. (Guest)
on 2006-03-26 01:27
(Received via mailing list)
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
Gerardo S. Gómez Garrido (Guest)
on 2006-03-26 01:52
(Received via mailing list)
2006/3/25, Butternut squash <removed_email_address@domain.invalid>:
> 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/sear...

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
http://santanatechnotes.blogspot.com/
Reid T. (Guest)
on 2006-03-26 03:03
(Received via mailing list)
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
Pat M. (Guest)
on 2006-03-26 06:11
(Received via mailing list)
On 3/25/06, Reid T. <removed_email_address@domain.invalid> 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.
Reid T. (Guest)
on 2006-03-26 08:36
(Received via mailing list)
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
Tom A. (Guest)
on 2006-03-26 08:48
(Received via mailing list)
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.
zdennis (Guest)
on 2006-03-26 08:49
(Received via mailing list)
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
unknown (Guest)
on 2006-03-26 09:05
(Received via mailing list)
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
Reid T. (Guest)
on 2006-03-26 09:38
(Received via mailing list)
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...
James B. (Guest)
on 2006-03-26 09:58
(Received via mailing list)
removed_email_address@domain.invalid 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?
unknown (Guest)
on 2006-03-26 10:21
(Received via mailing list)
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 ;-)

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
Robert D. (Guest)
on 2006-03-26 10:28
(Received via mailing list)
On 3/26/06, James B. <removed_email_address@domain.invalid> 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
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êtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.

- Albert Einstein
Simon Kröger (Guest)
on 2006-03-26 14:50
(Received via mailing list)
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
Christian N. (Guest)
on 2006-03-26 17:28
(Received via mailing list)
Tom A. <removed_email_address@domain.invalid> 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*
Pistos C. (Guest)
on 2006-03-27 20:41
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
Reid T. (Guest)
on 2006-03-27 21:23
(Received via mailing list)
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.
Rob Pitt (Guest)
on 2006-03-27 22:13
(Received via mailing list)
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
Dave H. (Guest)
on 2006-03-28 06:34
(Received via mailing list)
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}
This topic is locked and can not be replied to.