JDBC automatical query turned to be very slow

后端 未结 5 1931
一向
一向 2021-02-10 10:57

I am maintaining an application creating an Oracle DB via JDBC. Starting from today this query:

SELECT  NULL                                                   AS         


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-02-10 11:40

    I found this way to cheat.. run this as the user you connect with jdbc before you reverse engineer a schema..

    CREATE TABLE all_constraints AS
      SELECT owner,
             constraint_name,
             constraint_type,
             table_name,
             r_owner,
             r_constraint_name,
             delete_rule,
             status,
             deferrable,
             deferred,
             validated,
             generated,
             bad,
             rely,
             last_change,
             index_owner,
             index_name,
             invalid,
             view_related
      FROM   all_constraints;
    
    CREATE TABLE all_cons_columns AS
      SELECT *
      FROM   all_cons_columns;
    
    CREATE INDEX ac1
      ON all_constraints (owner, constraint_name, table_name);
    
    CREATE INDEX acc1
      ON all_cons_columns (owner, constraint_name, table_name);  
    

    Then the query in question really screams.. the downside is you have to refresh it from time to time.. maybe make it a materialized view?

提交回复
热议问题