RE: Re: OCI adapter slowdown on dictionary access


When hints are used, you may run into this:

ORA-03212: Temporary Segment cannot be created in locally-managed

It’s all about your DB setup.

As for the error you’re getting, I sent an older version! My mistake!!
Thanks for pointing that out!!!

Should be

          table_cols = %Q{
            select column_name, data_type, data_default,

decode(data_type, ‘NUMBER’, data_precision,
‘VARCHAR2’, data_length,
null) as length,
decode(data_type, ‘NUMBER’, data_scale, null)
as scale
from (select owner, table_name from
#{scope}_catalog where table_name = #{table}) cat,
(select * from #{scope}_synonyms where
synonym_name = #{table}) syn,
(select * from all_tab_columns) col
where cat.table_name = #{table}
and syn.synonym_name (+)= cat.table_name
and col.table_name = nvl(syn.table_name,
and col.owner = nvl(syn.table_owner, #{(scope ==
“all” ? “cat.owner” : “user”)}) }

The reason this works is that Oracle will run the subqueries first, and
then run the where cluases on the contents of the subqueries. The
original query actually has 42 steps and the inner most step is a full
table scan on the users table.)

The above query “prefetches” only the rows needed (and could be tuned
more to just include the columns needed).

So far it’s working for us. Our setup is a specific user accessing
their own objects via tables or synonyms.

-Brian H.


Hogan, Brian P. wrote:

            from (select owner, table_name from

their own objects via tables or synonyms.

-Brian H.

Here’s a diff between the ActiveRecord 1.13.2 (in RoR 1.0.0) and the
above code,
to make it easier to see what’s changed.