oracle-enhanced icon indicating copy to clipboard operation
oracle-enhanced copied to clipboard

Slow query, can it be replaced?

Open matthewtusker opened this issue 8 months ago • 1 comments

https://github.com/rsim/oracle-enhanced/blob/d5b3daf8bdac7578055467329bcb6600114ea47a/lib/active_record/connection_adapters/oracle_enhanced/connection.rb#L37-L56

The above query is hitting us hard in Production. I'm seeing ~2s responses for this query. Our dbas have suggested that it could be replaced with the following:

SELECT owner,object_name 
FROM all_objects 
WHERE owner=:table_owner 
  AND object_name=:table_name 
  AND object_type in ('TABLE','VIEW','SYNONYM');

I don't know enough about the inner workings of Oracle to know whether this is a useful improvement and whether it would work over all the supported versions of Oracle for this Gem. Can someone with a bit more knowledge provide me with some insight here?

matthewtusker avatar Mar 13 '25 14:03 matthewtusker

Also, we've tried to turn on schema caching and producing a cache file to avoid calling this query at all, but it's still being called. Is schema caching still available/working?

EDIT: It appears that schema caching only affects gathering table descriptions at boot time, so relevant to this discussion.

matthewtusker avatar Apr 03 '25 10:04 matthewtusker

I have been told that there's a DBMS.NAME_RESOLVE procedure which should be able to return the required information.

matthewtusker avatar Jun 16 '25 13:06 matthewtusker