索引优化一般步骤
查看指定sql_id的执行计划,重点是窥视绑定变量SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_AWR('',NULL,NULL,'ADVANCED'))将绑定变量代入SQL语句,在SQL Developer中查看详细执行计划。里面列出了访问方式及相关WHERE语句的对应关系。几个分析语句:#查看是否涉及强制转换DESC#查看表行数s
对存在空值的列建索引
转载:https://blog.csdn.net/shengsummer/article/details/43673679
一个复合索引的优化案例
示例SQL语句:点击(此处)折叠或打开select distinct A.time_id, A.seller, a.quantity_sold, A.amount_sold, B.tax_countryfrom sales_A A join sales_B B on B.prod_id = A.prod_id and B.cust_id = A.cust_id and ...
用WITH…AS改写标量子查询
示例1:点击(此处)折叠或打开select prod_id, prod_name, prod_list_price, (select max(quantity_sold) from sales s where s.prod_id = p.prod_id and s.time_id > p.prod_eff_from ) as max_quantity...
带汇总的标量子查询改写
示例1:点击(此处)折叠或打开select p.prod_id, p.prod_name, p.prod_category, (select sum(s.amount_sold) from sales s where s.prod_id = p.prod_id) as total_soldfrom products pPlan hash value: ...
用LEFT JOIN优化标量子查询
《Oracle查询优化改写》读书笔记以下示例语句执行计划点击(此处)折叠或打开select a.cust_id, (select b.cust_id from customers2 b where b.cust_id = a.cust_id) b_cust_id, (select b.cust_first_name from customers2 b where b.cust_id = a.cust_id) b_cus...