Skip to content


Add a prefetch default value for Oracle adapter #592

merged 1 commit into from

2 participants


On a company project that I'm working on, we found a performance issue on fetching a very small dataset (about 77 rows). After some research I've found the existence of this oci8's flag which fixes this issue.

Just to exemplify, the forementioned query speed dropped from 6~7 seconds to 0.15s.

To prevent that another one dismiss the sequel library for this kind of problem, I suggest a default value to this flag. By the way, the oracle_enchanced adapter for ActiveRecord already have this same default value (from where I stealed), so I don't think that it will do any harm :)

Thank you!

PS: Sorry about my bad english


This looks good to me. I think I do run with :prefetch_rows when I test on Oracle, so having it set by default makes sense.

@jeremyevans jeremyevans merged commit baefc7e into jeremyevans:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 11, 2012
  1. @andrewhr
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/sequel/adapters/oracle.rb
2 lib/sequel/adapters/oracle.rb
@@ -37,7 +37,7 @@ def connect(server)
dbname = opts[:host]
conn =[:user], opts[:password], dbname, opts[:privilege])
- conn.prefetch_rows = typecast_value_integer(opts[:prefetch_rows]) if opts[:prefetch_rows]
+ conn.prefetch_rows = typecast_value_integer(opts.fetch(:prefetch_rows, 100))
conn.autocommit = true
conn.non_blocking = true
Something went wrong with that request. Please try again.