如何加快查询到Oracle(选择表中包含FK的所有table_names)

时间:2013-09-25 16:36:28

标签: sql performance oracle


如果我无法更改数据库规则和结构,请帮助加快查询以选择所有在当前表上引用的表名和列名 谢谢

SELECT 
  DISTINCT AC.table_name, ACC.column_name  
FROM 
  all_constraints AC 
  INNER JOIN all_cons_columns ACC 
    ON ACC.table_name = AC.table_name 
       AND  
       ACC.constraint_name = AC.constraint_name  
WHERE 
  AC.r_constraint_name IN  (
    SELECT AC.constraint_name 
    FROM all_constraints AC 
    WHERE 
     table_name='CURRENT_TABLE' 
     AND 
     owner='SOME_DATABASE_NAME'
  )

0 个答案:

没有答案