预估db2、oracle、teradata数据库sql执行代价和时间方法

  • DB2

  只能得到cost 

    1. 执行存贮过程建表

      CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN', 'C', 
        CAST (NULL AS VARCHAR(128)),'数据库用户名');

   2. 执行

     EXPLAIN PLAN  SET QUERYNO =ID号用于查询分析结果 FOR 待分析的SQL语句;

   3.查询分析结果

     select total_cost from explain_statement
     where explain_level='P' and queryno= ID号 order by explain_time desc

  • oracle

1.执行

     explain plan for 待分析的SQL语句

2.查询结果

  select plan_table_output from table(dbms_xplan.display()) 

  • teradata


执行

    

explain  待分析的SQL语句



你可能感兴趣的:(数据库)