Difference between using ActiveRecord and DBI

Hello dudes,
    I'm sathish i have been working on ruby on rails past 6 to7 months.
but i couldn't find a solution for using activerecord or Dbi

    I found the problem in my app that, if we make query to database
using active record it'll make connection to database, after finish the
database query its not closing the connection defaultly. i found the
solution to disconnect and reconnecting the database thru active record
like as dbi.

    Still i have the problem in performance. I want to know which is
best use to connect the database everytime. i have to read the table
which has more than 20 lak records. This connection will happen to
retrieve hour(more than 10,000 records /hour)basis records .

    Please let me know which is the best use for connecting the database
table which has more than 1 million records.

sathish kumar

Hi Sathish,

This is the wrong mailing list for these kind of usage questions. The
list you want is rubyonrails-talk. Please post anything new on that

But I'd recommend trying ActiveRecord::Base.connection.select_all and
friends and then just benchmark their speed against DBI.