# Possible to set "PRAGMA default\_synchronous=OFF" for my sqlite connection via AR?

**URL:** <https://www.ruby-forum.com/t/possible-to-set-pragma-default-synchronous-off-for-my-sqlite-connection-via-ar/168117>\
**Category:** Rails\
**Created:** [May 16, 2009, 7:20am UTC](https://www.ruby-forum.com/t/possible-to-set-pragma-default-synchronous-off-for-my-sqlite-connection-via-ar/168117 "2009-05-16T07:20:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpardee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rpardee](https://www.ruby-forum.com/u/rpardee)\
**Post date:** [May 16, 2009, 7:20am UTC](https://www.ruby-forum.com/t/possible-to-set-pragma-default-synchronous-off-for-my-sqlite-connection-via-ar/168117/1 "2009-05-16T07:20:21Z")

</div>

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/aQuickGuideToSQLite.html](http://whytheluckystiff.net/articles/aQuickGuideToSQLite.html) 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

---

<div class="post-metadata">

**Author:** ![rpardee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rpardee](https://www.ruby-forum.com/u/rpardee)\
**Post date:** [May 18, 2009, 2:44am UTC](https://www.ruby-forum.com/t/possible-to-set-pragma-default-synchronous-off-for-my-sqlite-connection-via-ar/168117/2 "2009-05-18T02:44:51Z")

</div>

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… ☹
