OCI adapter slowdown on dictionary access


#1

Hi,

after some experience with Rails on MySQL databases I gave it a try on
one
of our larger Oracle database.
I was facing a problem when Rails tried to detect the columns for a
model/table. The appropriate statement ran about 1 min which led to a
timeout.
Our Oracle guru told me to analyze the SYSTEM schema. After that hadn’t
helped, he said the only remaining chance is to use a hint in the
statement. Other tools like TOAD would do it by themself anyway…

I made the change in oci_adapter.rb and Rails was responsive again. If
anybody else has this problem or if anybody wants to include the change
into the next ActiveRecord version, here is what I’ve changed:

in
activerecord-1.13.2/lib/active_record/connection_adapters/oci_adapter.rb
at line 341 (in the #columns method):

  • select column_name, data_type, data_default, nullable,
  • select /*+ RULE */ column_name, data_type, data_default, nullable,

Best regards and thanks for the great framework,
Andreas G.


#2

Andreas G. wrote:

in activerecord-1.13.2/lib/active_record/connection_adapters/oci_adapter.rb
at line 341 (in the #columns method):

  • select column_name, data_type, data_default, nullable,
  • select /*+ RULE */ column_name, data_type, data_default, nullable,
    You’ll have to excuse my ignorance, having had no deep exposure to
    Oracle: what does that actually do?