Slow bulk insert query

As part of my application I calculate/generate a fair chunk of data, and
I then stick the reults into the database (mysql). This takes the form
of a single "INSERT INTO foo(…) VALUES(…) " statement that is approx
The dats itself consists of pairs of integers.
If I dump the query string to disk and paste it into the query browser
and run it then execution is <1 second.
If however I do ActiveRecord::Base.connection.execute sql_statement
then it takes 50 odd seconds to run. During this time cpu load is close
to nothing.

Any ideas on what could be causing this slow down?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs