Forum: Ruby on Rails RE: Oracle and Rails seems really slow.... In development

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.
60e38de043848f82392062088f191213?d=identicon&s=25 Hogan, Brian P. (Guest)
on 2006-01-13 21:17
(Received via mailing list)
Neat!

>From my findings, though.... This is what I noticed:

The original code:

	          table_cols = %Q{
	            select column_name, data_type, data_default,
nullable,
	                   decode(data_type, 'NUMBER', data_precision,
	                                     'VARCHAR2', data_length,
	                                      null) as length,
	                   decode(data_type, 'NUMBER', data_scale, null)
as scale
	              from #{scope}_catalog cat, #{scope}_synonyms syn,
all_tab_columns col
	             where cat.table_name = #{table}
	               and syn.synonym_name (+)= cat.table_name
	               and col.table_name = nvl(syn.table_name,
cat.table_name)
	               and col.owner = nvl(syn.table_owner, #{(scope ==
"all" ? "cat.owner" : "user")}) }



My version



	          table_cols = %Q{
	            select column_name, data_type, data_default,
nullable,
	                   decode(data_type, 'NUMBER', data_precision,
	                                     'VARCHAR2', data_length,
	                                      null) as length,
	                   decode(data_type, 'NUMBER', data_scale, null)
as scale
	              from #{scope}_catalog cat, #{scope}_synonyms syn,
all_tab_columns col
	             where col.table_name = #{table}
	               and syn.synonym_name (+)= cat.table_name
	               and col.table_name = nvl(syn.table_name,
cat.table_name)
	               and col.owner = nvl(syn.table_owner, #{(scope ==
"all" ? "cat.owner" : "user")}) }



Runs no problem.

I just changed

where cat.table_name = #{table}

To
where col.table_name = #{table}


Since the ALL_TAB_COLUMNS has the table name, this works great.... And
this fix makes it just fly!
2073c7e0e7d2311727b680a887a375be?d=identicon&s=25 Leon Leslie (Guest)
on 2006-01-13 22:30
(Received via mailing list)
Is this a patch?
This topic is locked and can not be replied to.