select emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id

-- 不加hint
SQL> select emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id ;
已用时间: 00: 00: 00.00 执行计划
----------------------------------------------------------
Plan hash value: 2666916627 --------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1818K| 97M| 3619 (2)| 00:00:44 |
|* 1 | HASH JOIN | | 1818K| 97M| 3619 (2)| 00:00:44 |
| 2 | TABLE ACCESS FULL| TB_DEPT03 | 10 | 160 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| TB_EMP03 | 2000K| 76M| 3601 (1)| 00:00:44 |
-------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - access("EMP"."DEPTNO"="DEPT"."ID") select /*+ leading(emp,dept) use_nl(emp) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
SQL> select /*+ leading(emp,dept) use_nl(emp) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
已用时间: 00: 00: 00.00 执行计划
----------------------------------------------------------
Plan hash value: 960397288 ----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1818K| 97M| | 8558 (1)| 00:01:43 |
|* 1 | HASH JOIN | | 1818K| 97M| 99M| 8558 (1)| 00:01:43 |
| 2 | TABLE ACCESS FULL| TB_EMP03 | 2000K| 76M| | 3601 (1)| 00:00:44 |
| 3 | TABLE ACCESS FULL| TB_DEPT03 | 10 | 160 | | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - access("EMP"."DEPTNO"="DEPT"."ID") select /*+ leading(dept,emp) use_nldept) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
SQL> select /*+ leading(dept,emp) use_nldept) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
已用时间: 00: 00: 00.00 执行计划
----------------------------------------------------------
Plan hash value: 2666916627 --------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1818K| 97M| 3619 (2)| 00:00:44 |
|* 1 | HASH JOIN | | 1818K| 97M| 3619 (2)| 00:00:44 |
| 2 | TABLE ACCESS FULL| TB_DEPT03 | 10 | 160 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| TB_EMP03 | 2000K| 76M| 3601 (1)| 00:00:44 |
-------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - access("EMP"."DEPTNO"="DEPT"."ID") select /*+ ordered */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
SQL> select /*+ ordered */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
已用时间: 00: 00: 00.00 执行计划
----------------------------------------------------------
Plan hash value: 960397288 ----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1818K| 97M| | 8558 (1)| 00:01:43 |
|* 1 | HASH JOIN | | 1818K| 97M| 99M| 8558 (1)| 00:01:43 |
| 2 | TABLE ACCESS FULL| TB_EMP03 | 2000K| 76M| | 3601 (1)| 00:00:44 |
| 3 | TABLE ACCESS FULL| TB_DEPT03 | 10 | 160 | | 3 (0)| 00:00:01 |
---------------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - access("EMP"."DEPTNO"="DEPT"."ID") select /*+ use_hash(dept,emp) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
SQL> select /*+ use_hash(dept,emp) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
已用时间: 00: 00: 00.00 执行计划
----------------------------------------------------------
Plan hash value: 2666916627 --------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1818K| 97M| 3619 (2)| 00:00:44 |
|* 1 | HASH JOIN | | 1818K| 97M| 3619 (2)| 00:00:44 |
| 2 | TABLE ACCESS FULL| TB_DEPT03 | 10 | 160 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| TB_EMP03 | 2000K| 76M| 3601 (1)| 00:00:44 |
-------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - access("EMP"."DEPTNO"="DEPT"."ID") select /*+ use_hash(emp,dept) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
SQL> select /*+ use_hash(emp,dept) */emp.*,dept.* from tb_emp03 emp,tb_dept03 dept where emp.deptno=dept.id;
已用时间: 00: 00: 00.00 执行计划
----------------------------------------------------------
Plan hash value: 2666916627 --------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1818K| 97M| 3619 (2)| 00:00:44 |
|* 1 | HASH JOIN | | 1818K| 97M| 3619 (2)| 00:00:44 |
| 2 | TABLE ACCESS FULL| TB_DEPT03 | 10 | 160 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS FULL| TB_EMP03 | 2000K| 76M| 3601 (1)| 00:00:44 |
-------------------------------------------------------------------------------- Predicate Information (identified by operation id):
--------------------------------------------------- 1 - access("EMP"."DEPTNO"="DEPT"."ID")

从两表连接看Oracle sql优化器的效果的更多相关文章

  1. Oracle SQL优化器简介

    目录 一.Oracle的优化器 1.1 优化器简介 1.2 SQL执行过程 二.优化器优化方式 2.1 优化器的优化方式 2.2 基于规则的优化器 2.3 基于成本的优化器 三.优化器优化模式 3.1 ...

  2. oracle sql 优化大全

    转自: http://panshaobinsb.iteye.com/blog/1718233 http://yulimeander.blog.sohu.com/115850824.html 最近遇到了 ...

  3. SQL优化器-RBO与CBO分别是什么

    数据库系统发展历史 数据库系统产生于20世纪60年代中期,至今有近50多年的历史,其发展经历了三代演变,造就了四位图灵奖得主,发展成为一门计算机基础学科,带动了一个巨大的软件产业. 数据库系统是操作系 ...

  4. 【重磅干货】看了此文,Oracle SQL优化文章不必再看!

    目录 SQL优化的本质 SQL优化Road Map 2.1 制定SQL优化目标 2.2 检查执行计划 2.3 检查统计信息 2.4 检查高效访问结构 2.5 检查影响优化器的参数 2.6 SQL语句编 ...

  5. Oracle SQL优化[转]

    Oracle SQL优化 1. 选用适合的ORACLE优化器 ORACLE的优化器共有3种: a. RULE (基于规则) b. COST (基于成本) c. CHOOSE (选择性) 设置缺省的优化 ...

  6. Oracle SQL优化规则详解

    1. 选用适合的Oracle优化器 Oracle的优化器共有3种: a. RULE (基于规则) b. COST (基于成本) c. CHOOSE (选择性) 设置缺省的优化器,可以通过对init.o ...

  7. Oracle SQL优化一(常见方法)

    1.表访问方式优化: a)普通表优先“Index Lookup 索引扫描”,避免全表扫描 大多数场景下,通过“Index Lookup 索引扫描”要比“Full Table Scan (FTS) 全表 ...

  8. [terry笔记]Oracle SQL 优化之sql tuning advisor (STA)

    前言:经常可以碰到优化sql的需求,开发人员直接扔过来一个SQL让DBA优化,然后怎么办? 当然,经验丰富的DBA可以从各种方向下手,有时通过建立正确索引即可获得很好的优化效果,但是那些复杂SQL错综 ...

  9. SQL server 表结构转Oracle SQL脚本

    SQL server 表结构转Oracle SQL脚本 /****** Object: StoredProcedure [dbo].[getOracle] Script Date: 2019/7/25 ...

随机推荐

  1. javascript数组笔记

    1.数组 2.利用new创建数组 var arr= new Array(); 3.利用数组字面量创建数组 var 数组名=[]; 4.数组里面的数据叫 5.数组的索引(数组下标从0开始) 6.遍历数组 ...

  2. 微信小程序开发着工具获取和更新newticket

    newticket是微信开发者工具和微信后台交互的凭证.大多数工具的操作都是需要newticket. 如何获取newticket? 打开开发者工具,依次点击菜单设置->通用设置->代理,使 ...

  3. C#LeetCode刷题-记忆化

    记忆化篇 # 题名 刷题 通过率 难度 329 矩阵中的最长递增路径   31.0% 困难

  4. 338. Counting Bits题目详解

    题目详情 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate ...

  5. CODING DevOps 代码质量实战系列最后一课,周四发车

    随着 ToB(企业服务)的兴起和 ToC(消费互联网)产品进入成熟期,线上故障带来的损失越来越大,代码质量越来越重要,而「质量内建」正是 DevOps 核心理念之一. <DevOps 代码质量实 ...

  6. jQuery的基础效果题

    Jquery第二次考核 之真金不怕火炼 1.  名词解释 实例对象:var p1=new Person();  p1就是实例对象 构造:function Person(){} 原型对象:在 JavaS ...

  7. idea的热加载与热部署

    一:热加载与热部署     热部署的意思就是不用手动重启环境,修改类后,项目会自动重启.但是如果项目比较大,重启也需要耗时十几秒左右.     热加载意为不需要重新启动,修改了什么文件就重新加载什么文 ...

  8. 单元测试报错:Mybatis中数据库语句错误

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste ...

  9. golang 递归自己,输出自己的源代码

    问题: [2min 大家自己想想] 一个程序P运行后能否输出自己的源代码?并且格式保持一致(换行.空格等) 思考: 这个问题的本质是一个递归问题,设有P运行后生成G 既P->G &&am ...

  10. hdfs常用api(java)

    1.下载文件到本地 public class HdfsUrlTest { static{ //注册url 让java程序识别hdfs的url URL.setURLStreamHandlerFactor ...