Forum: Ruby on Rails possible to set "PRAGMA default_synchronous=OFF" for my sqlite connection via AR?

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.
Roy P. (Guest)
on 2009-05-16 09:20
(Received via mailing list)
Hey All,

I'm using ActiveRecord w/the sqlite3 adapter and finding it slow for
my use.  After reading _whytheluckystiff's
http://whytheluckystiff.net/articles/aQuickGuideTo... I
wondered if it's possible to configure the default_synchronous option
on an ActiveRecord connection.  Does anyone know if this is possible?

I tried

ActiveRecord::Base.establish_connection(
      :adapter => "sqlite3",
      :database => STORE + "test.db",
      :options => "PRAGMA default_synchronous=OFF"
)

and

ActiveRecord::Base.establish_connection(
      :adapter => "sqlite3",
      :database => STORE + "test.db",
      :default_synchronous => "OFF"
)

and didn't get any errors, but I'm not seeing any speed increase
either (also, it looks like I can pass any gobbledygook in as :options
and not get any errors).  So I'm hoping I'm doing it wrong and someone
here can tell me how to do it right.

Many thanks!

-Roy
Roy P. (Guest)
on 2009-05-18 04:44
(Received via mailing list)
If nothing else, it appears that you can do:

  c = ::ActiveRecord::Base.connection
  c.execute("PRAGMA default_synchronous=OFF")

I'm not sure if there's a way to pass this as an option to
AR:Base.establish_connection.

Doing this gives me a a bit of a speed boost (that's perceived--I'm
not actually measuring or anything) but not the rip-roaring one I was
hoping for... :(
This topic is locked and can not be replied to.