《收获,不止Oracle》表的连接学以致用

news2024/11/17 13:19:59

 6.2 三大类型

6.2.1 连接类型

嵌套循环

排序合并及散列连接

第一种方式就是数据库表连接中的嵌套循环连接(Nested Loops Join),而第二种方式就是表连接中的排序合并连接(Merge Sort Join)或者散列连接(Hash Join),请大家记住。

我在这里要告诉大家,在电信、金融等领域的数据库相关应用中,表连接总体的比例情况大致为,嵌套循环连接占70%左右,而散列连接占20%,剩下大致10%是排序合并连接。”

各类连接被访问次数的差异

研究嵌套循环连接的表的被访问次数前的准备

[oracle@oracle-db-19c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Sun Jan 29 12:47:17 2023
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> 
SQL> conn maxwellpan/maxwellpan@PDB1
Connected.
SQL> 
SQL> 
SQL> show user;
USER is "MAXWELLPAN"
SQL> 
SQL> 
SQL> drop table t1 cascade constraints purge;

Table dropped.

SQL> drop table t2 cascade constraints purge;

Table dropped.

SQL> create table t1 (
  2    id number not null,
  3    n number,
  4    contents varchar2(4000)
  5  );

Table created.

SQL> create table t2 (
  2    id number not null,
  3    t1_id number not null,
  4    n number,
  5    contents varchar2(4000)
  6  );

Table created.

SQL> execute dbms_random.seed(0);

PL/SQL procedure successfully completed.

SQL> INSERT INTO T1
  2    SELECT rownum,rownum,dbms_random.string('a',50)
  3  from dual
  4  connect by level <= 100
  5  order by dbms_random.random;

100 rows created.

SQL> INSERT INTO T2
  2    SELECT rownum,rownum,rownum,dbms_random.string('a',50)
  3  from dual
  4  connect by level <= 100000
  5  order by dbms_random.random;

100000 rows created.

SQL> commit;

Commit complete.

SQL> select count(*) from t1;

  COUNT(*)
----------
       100

SQL> select count(*) from t2;

  COUNT(*)
----------
    100000

SQL> 

测试表连接的写法如下:

select /*+leading(t1)use_nl(t2)*/
 *
  from t1, t2
 where t1.id = t2.t1_id;

研究嵌套循环连接,t2表被访问100次

SQL> set linesize 1000
SQL> alter session set statistics_level=all;

Session altered.

SQL> select /*+leading(t1)use_nl(t2)*/
  2   *
  3    from t1, t2
  4   where t1.id = t2.t1_id;

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        12         12
LIoEWaAdhvdNAhpdbdpIawQFQDmzebzEqwwChvFHDhoRfrlVrc
        12         12         12
OtnpOjHihZjuQvFTrbUnzdudicUrhVdHalzMpNSmzDmxpXjChe


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        22         22
oXzAinzjnUtJrhwPzWHTktpdZPTPHTkYAyjsmYMawihqyolJuT
        22         22         22
hsGLxPQWFPExbxjfezItjqsfjSYObxxfmcDjjjhxiUIWORrFhQ


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        10         10
InblvsVdzHVVPFElOsSWtRLkqAJwytraTSsWMoEaoYNAuAoIrI
        10         10         10
uLeVTecJSNhjCPcXeiyONxMIFQvaqLuFyuvWDvBuyiHLeWzlbh

100 rows selected.

SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  fx7936hqx6118, child number 0
-------------------------------------
select /*+leading(t1)use_nl(t2)*/  *   from t1, t2  where t1.id =
t2.t1_id

Plan hash value: 1967407726

-------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |    100 |00:00:00.30 |     100K|

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  NESTED LOOPS      |      |      1 |    100 |    100 |00:00:00.30 |     100K|
|   2 |   TABLE ACCESS FULL| T1   |      1 |    100 |    100 |00:00:00.01 |      14 |
|*  3 |   TABLE ACCESS FULL| T2   |    100 |      1 |    100 |00:00:00.29 |     100K|
-------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - filter("T1"."ID"="T2"."T1_ID")

Note

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----
   - dynamic statistics used: dynamic sampling (level=2)


25 rows selected.

SQL> 

100次怎么变成了2 次

在刚才的基础上,我们继续跟踪观察如下语句,差别在于增加了t1的条件:

 select /*+leading(t1)use_nl(t2)*/
  *
   from t1, t2
  where t1.id = t2.t1_id
    and t1.n in (17, 19);

换个语句,这次t2表被访问2次

SQL> 
SQL>  select /*+leading(t1)use_nl(t2)*/
  2    *
  3     from t1, t2
  4    where t1.id = t2.t1_id
  5      and t1.n in (17, 19);

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        17         17
mcbXTSZhvccAomKZZJdfSanBDAlVYefHAurNoryMikSJjeobGT
        17         17         17
RXWlAksGJyRTYvRYzcAApNTJZhZSOXvBPBpdwujRLERFshXvCm


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  gfdsv34x0r9gx, child number 0
-------------------------------------
 select /*+leading(t1)use_nl(t2)*/   *    from t1, t2   where t1.id =
t2.t1_id     and t1.n in (17, 19)

Plan hash value: 1967407726

-------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      2 |00:00:00.01 |    2019 |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  NESTED LOOPS      |      |      1 |      2 |      2 |00:00:00.01 |    2019 |
|*  2 |   TABLE ACCESS FULL| T1   |      1 |      2 |      2 |00:00:00.01 |       8 |
|*  3 |   TABLE ACCESS FULL| T2   |      2 |      1 |      2 |00:00:00.01 |    2011 |
-------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter(("T1"."N"=17 OR "T1"."N"=19))
   3 - filter("T1"."ID"="T2"."T1_ID")


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 

2次怎么变成1 次

继续换个语句,这次t2表被访问1次

SQL> 
SQL>  select /*+leading(t1)use_nl(t2)*/
  2    *
  3     from t1, t2
  4    where t1.id = t2.t1_id
  5      and t1.n =19;

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  b08tygwk2nmbh, child number 0
-------------------------------------
 select /*+leading(t1)use_nl(t2)*/   *    from t1, t2   where t1.id =
t2.t1_id     and t1.n =19

Plan hash value: 1967407726

-------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      1 |00:00:00.01 |    1014 |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  NESTED LOOPS      |      |      1 |      1 |      1 |00:00:00.01 |    1014 |
|*  2 |   TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       8 |
|*  3 |   TABLE ACCESS FULL| T2   |      1 |      1 |      1 |00:00:00.01 |    1006 |
-------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("T1"."N"=19)
   3 - filter("T1"."ID"="T2"."T1_ID")


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 

1次又变成 0次

改写到最后,t2表居然被访问0次

SQL> 
SQL>  select /*+leading(t1)use_nl(t2)*/
  2    *
  3     from t1, t2
  4    where t1.id = t2.t1_id
  5      and t1.n =999999999;

no rows selected

SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  b30dn2nuuz6zt, child number 0
-------------------------------------
 select /*+leading(t1)use_nl(t2)*/   *    from t1, t2   where t1.id =
t2.t1_id     and t1.n =999999999

Plan hash value: 1967407726

-------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      0 |00:00:00.01 |       7 |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  NESTED LOOPS      |      |      1 |      1 |      0 |00:00:00.01 |       7 |
|*  2 |   TABLE ACCESS FULL| T1   |      1 |      1 |      0 |00:00:00.01 |       7 |
|*  3 |   TABLE ACCESS FULL| T2   |      0 |      1 |      0 |00:00:00.01 |       0 |
-------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("T1"."N"=999999999)
   3 - filter("T1"."ID"="T2"."T1_ID")


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 



嵌套循环连接访问次数的最终结论

t1表的查询返回多少条记录,t2表就被访问多少次。第一次t1表返回100条记录,是因为t1表全表就是100条记录,无条件查询当然就是返回100条;而第二次AND t1.n in(17,19)的条件让t1表返回2条记录,所以t2表被访问2次;第三次AND t1.n=19的条件让t1表的查询只返回1条记录,所以t2表被访问1次;最后一次AND t1.n=999999999这个条件显然是从t1表中查不出任何记录的,所以t2表被访问0次,干脆就不被访问了!

分析t2表被访问次数不同的原因

SQL> ---解释t2表为什么被访问100次
SQL> select count(*) from t1;

  COUNT(*)
----------
       100

SQL> 
SQL> ---解释t2表为什么被访问2次
SQL> select count(*) from t1 where t1.n in (17, 19);

  COUNT(*)
----------
         2

SQL> 
SQL> ---解释t2表为什么被访问1次
SQL> select count(*) from t1 where t1.n = 19;

  COUNT(*)
----------
         1

SQL> 
SQL> 
SQL> ---解释t2表为什么被访问0次
SQL> select count(*) from t1 where t1.n = 999999999;

  COUNT(*)
----------
         0

SQL> 

散列连接的表被访问的次数

测试t2表仅被访问1次

select /*+leading(t1)use_hash(t2)*/*
  from t1, t2
 where t1.id = t2.t1_id;

散列连接中t2表只会被访问1次或0次

SQL> 
SQL> select /*+leading(t1)use_hash(t2)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id;

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        29         29
UdyZOgyQOYrowfGAmMLgKAwNXFpmsbAhvkwzESohhOaHvLSHfD
        29         29         29
NBgeTJqQwABblhuRRZbsaTdpulkvFzlpGKYwNGnuTiEHxbBQqp

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        96         96
PDjlvYcPtkTrFCITsiRPtGAdqEImtZYckVgLyJzYQpSYKwnbDy
        96         96         96
vxBFUdYBjpaXikSdvkYxaTZulJFcZrHAkDmeBrDYtghvZakvex


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        51         51
OSvQYvjxmyzzGMnFGccgQPuuiLtDgJNADGvxNkSLCWEeCFXWpP
        51         51         51
xwcqdBlQwpumvozClyiAdXkfsfzoQfhfuSyKctENvbfITolNtj


100 rows selected.

SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  8m9zqja907n7j, child number 0
-------------------------------------
select /*+leading(t1)use_hash(t2)*/*   from t1, t2  where t1.id =
t2.t1_id

Plan hash value: 1838229974

----------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |    100 |00:00:00.01 |    1083 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*  1 |  HASH JOIN         |      |      1 |    100 |    100 |00:00:00.01 |    1083 |  1000K|  1000K| 1346K (0)|
|   2 |   TABLE ACCESS FULL| T1   |      1 |    100 |    100 |00:00:00.01 |       7 |       |       |          |
|   3 |   TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1012 |       |       |          |
----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("T1"."ID"="T2"."T1_ID")

Note

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----
   - dynamic statistics used: dynamic sampling (level=2)


25 rows selected.

SQL> 

散列连接准确结论

不过更准确的说法应该是:在散列连接中,驱动表和被驱动表都只会被访问0次或者1次。

Hash Join中t2表被访问0次的情况

SQL> 
SQL> select /*+leading(t1)use_hash(t2)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id
  4   and t1.n = 999999999;

no rows selected

SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  9p23u2b7c4tjw, child number 0
-------------------------------------
select /*+leading(t1)use_hash(t2)*/*   from t1, t2  where t1.id =
t2.t1_id  and t1.n = 999999999

Plan hash value: 1838229974

----------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      0 |00:00:00.01 |       7 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*  1 |  HASH JOIN         |      |      1 |      1 |      0 |00:00:00.01 |       7 |   685K|   685K|  179K (0)|
|*  2 |   TABLE ACCESS FULL| T1   |      1 |      1 |      0 |00:00:00.01 |       7 |       |       |          |
|   3 |   TABLE ACCESS FULL| T2   |      0 |  98810 |      0 |00:00:00.01 |       0 |       |       |          |
----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("T1"."ID"="T2"."T1_ID")
   2 - filter("T1"."N"=999999999)


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 

散列连接中t1表和t2表都被访问0次的情况

SQL> 
SQL>  select /*+leading(t1)use_hash(t2)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id
  4   and 1=2;

no rows selected

SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  4jcf0cucqftuu, child number 0
-------------------------------------
 select /*+leading(t1)use_hash(t2)*/*   from t1, t2  where t1.id =
t2.t1_id  and 1=2

Plan hash value: 487071653

----------------------------------------------------------------------------
| Id  | Operation           | Name | Starts | E-Rows | A-Rows |   A-Time   |
----------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |      |      1 |        |      0 |00:00:00.01 |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*  1 |  FILTER             |      |      1 |        |      0 |00:00:00.01 |
|*  2 |   HASH JOIN         |      |      0 |    100 |      0 |00:00:00.01 |
|   3 |    TABLE ACCESS FULL| T1   |      0 |    100 |      0 |00:00:00.01 |
|   4 |    TABLE ACCESS FULL| T2   |      0 |  98810 |      0 |00:00:00.01 |
----------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - filter(NULL IS NOT NULL)
   2 - access("T1"."ID"="T2"."T1_ID")

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


27 rows selected.

SQL> 





排序合并连接的表被访问的次数

排序合并连接的访问情况和散列连接一样

SQL> 
SQL> select /*+ordered use_merge(t2)*/*
  2   from t1, t2
  3  where t1.id = t2.t1_id;

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
         1          1
rMLTDXxxqXOZnqYRJwInlGfGBTxNkAszBGEUGELqTSRnFjRGbi
         1          1          1
oEDjYpmoOoPPCgRApZewlJvzMTsosHAFerbsFWoxLAExnGcaPH


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
         2          2
UEDJsfIgoYqwreSuuvjIcPZarpxMdCthpDCsgPlJfvIiylLiBS
         2          2          2
RcGqBYvXQxnttfqIICFyBaiuYPXacaNFUOrGCmzJDKhrrrMGqL
100 rows selected.

SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  b3dw96yzr1k2k, child number 0
-------------------------------------
select /*+ordered use_merge(t2)*/*  from t1, t2 where t1.id = t2.t1_id

Plan hash value: 412793182

-----------------------------------------------------------------------------------------------------------------
| Id  | Operation           | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
-----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |      |      1 |        |    100 |00:00:00.03 |    1012 |       |       |          |
|   1 |  MERGE JOIN         |      |      1 |    100 |    100 |00:00:00.03 |    1012 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   2 |   SORT JOIN         |      |      1 |    100 |    100 |00:00:00.01 |       7 | 13312 | 13312 |12288  (0)|
|   3 |    TABLE ACCESS FULL| T1   |      1 |    100 |    100 |00:00:00.01 |       7 |       |       |          |
|*  4 |   SORT JOIN         |      |    100 |  98810 |    100 |00:00:00.03 |    1005 |  9762K|  1209K| 8677K (0)|
|   5 |    TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1005 |       |       |          |
-----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("T1"."ID"="T2"."T1_ID")
       filter("T1"."ID"="T2"."T1_ID")

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


27 rows selected.

SQL>

显然可以看出来,在访问次数上,排序合并连接和散列连接是一样的,t1表和t2表都只会被访问0次或者1次。

排序合并连接根本就没有驱动和被驱动的概念,而嵌套循环连接和散列连接要考虑驱动和被驱动情况。

各类连接驱动顺序的区别

嵌套循环连接的表驱动顺序

嵌套循环连接中t1表先被访问的情况

SQL> 
SQL> alter session set statistics_level=all;

Session altered.

SQL>  select /*+leading(t1)use_nl(t2)*/
  2    *
  3     from t1, t2
  4    where t1.id = t2.t1_id
  5      and t1.n =19;

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  b08tygwk2nmbh, child number 0
-------------------------------------
 select /*+leading(t1)use_nl(t2)*/   *    from t1, t2   where t1.id =
t2.t1_id     and t1.n =19

Plan hash value: 1967407726

-------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      1 |00:00:00.01 |    1014 |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  NESTED LOOPS      |      |      1 |      1 |      1 |00:00:00.01 |    1014 |
|*  2 |   TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       8 |
|*  3 |   TABLE ACCESS FULL| T2   |      1 |      1 |      1 |00:00:00.01 |    1006 |
-------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - filter("T1"."N"=19)
   3 - filter("T1"."ID"="T2"."T1_ID")


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 

嵌套循环连接中t2表先被访问的情况

SQL> 
SQL>   select /*+leading(t2)use_nl(t1)*/
  2    *
  3     from t1, t2
  4    where t1.id = t2.t1_id
  5      and t1.n =19;

        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  dyt6y9v61aprm, child number 0
-------------------------------------
  select /*+leading(t2)use_nl(t1)*/   *    from t1, t2   where t1.id =
t2.t1_id     and t1.n =19

Plan hash value: 4016936828

-------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
-------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      1 |00:00:00.58 |     701K|

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  NESTED LOOPS      |      |      1 |      1 |      1 |00:00:00.58 |     701K|
|   2 |   TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1006 |
|*  3 |   TABLE ACCESS FULL| T1   |    100K|      1 |      1 |00:00:00.55 |     700K|
-------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - filter(("T1"."ID"="T2"."T1_ID" AND "T1"."N"=19))

Note

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-----
   - dynamic statistics used: dynamic sampling (level=2)


25 rows selected.

SQL> 

散列连接的表驱动顺序

散列连接中t1表先被访问的情况

SQL> 
SQL> ---观察t1先被访问的情况
SQL> alter session set statistics_level=all;    

Session altered.

SQL> select /*+leading(t1)use_hash(t2)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id
  4    and t1.n =19;


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  5fthzm536j4c3, child number 0
-------------------------------------
select /*+leading(t1)use_hash(t2)*/*   from t1, t2  where t1.id =
t2.t1_id   and t1.n =19

Plan hash value: 1838229974

----------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      1 |00:00:00.01 |    1077 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*  1 |  HASH JOIN         |      |      1 |      1 |      1 |00:00:00.01 |    1077 |  1000K|  1000K|  423K (0)|
|*  2 |   TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       7 |       |       |          |
|   3 |   TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1006 |       |       |          |
----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("T1"."ID"="T2"."T1_ID")
   2 - filter("T1"."N"=19)


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 

 散列连接中t2表先被访问的情况

SQL> ---观察t2先被访问的情况
SQL> alter session set statistics_level=all;    

Session altered.

SQL> select /*+leading(t2)use_hash(t1)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id
  4    and t1.n =19;


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  9mgbxa9k7ttms, child number 0
-------------------------------------
select /*+leading(t2)use_hash(t1)*/*   from t1, t2  where t1.id =
t2.t1_id   and t1.n =19

Plan hash value: 2959412835

----------------------------------------------------------------------------------------------------------------
| Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |      1 |        |      1 |00:00:00.03 |    1013 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*  1 |  HASH JOIN         |      |      1 |      1 |      1 |00:00:00.03 |    1013 |    12M|  2564K|   15M (0)|
|   2 |   TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1005 |       |       |          |
|*  3 |   TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       8 |       |       |          |
----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   1 - access("T1"."ID"="T2"."T1_ID")
   3 - filter("T1"."N"=19)


PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


26 rows selected.

SQL> 

t1表先被访问的情况下Buffers是1013,而t2表先被访问的情况下,Buffers也是1013,但是Used-Mem却差异明显,前者是286KB,后者是11MB,说明排序尺寸差异明显。再结合时间来看,前者是0.04秒,后者是0.1秒,差别也不小。“说明散列连接中驱动表的顺序非常重要,性能差别也很明显!

排序合并的表驱动顺序

排序合并连接中t1表先被访问的情况

SQL> ---观察t1先被访问的情况
SQL> alter session set statistics_level=all;    

Session altered.

SQL> select /*+leading(t1)use_merge(t2)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id
  4    and t1.n =19;


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  dxvtjqg2dgjfy, child number 0
-------------------------------------
select /*+leading(t1)use_merge(t2)*/*   from t1, t2  where t1.id =
t2.t1_id   and t1.n =19

Plan hash value: 412793182

-----------------------------------------------------------------------------------------------------------------
| Id  | Operation           | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
-----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |      |      1 |        |      1 |00:00:00.03 |    1012 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  MERGE JOIN         |      |      1 |      1 |      1 |00:00:00.03 |    1012 |       |       |          |
|   2 |   SORT JOIN         |      |      1 |      1 |      1 |00:00:00.01 |       7 |  2048 |  2048 | 2048  (0)|
|*  3 |    TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       7 |       |       |          |
|*  4 |   SORT JOIN         |      |      1 |  98810 |      1 |00:00:00.03 |    1005 |  9762K|  1209K| 8677K (0)|
|   5 |    TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1005 |       |       |          |
-----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   3 - filter("T1"."N"=19)

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   4 - access("T1"."ID"="T2"."T1_ID")
       filter("T1"."ID"="T2"."T1_ID")

Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


29 rows selected.

SQL> 

 排序合并连接中t2表先被访问的情况

SQL> ---观察t2先被访问的情况
SQL> alter session set statistics_level=all;    

Session altered.

SQL> select /*+leading(t2)use_merge(t1)*/*
  2    from t1, t2
  3   where t1.id = t2.t1_id
  4    and t1.n =19;


        ID          N
---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        ID      T1_ID          N
---------- ---------- ----------
CONTENTS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        19         19
jAOYAJHBzwhNWHImZeFUOaxvMycbQsCLKhsUnSFwZpyctEahjK
        19         19         19
GjEZVArATZoLjgeBswAqZZshWrhgQeEKLYScUQqMtlFclNtjHK


SQL> SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'));

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID  cythx275yxzr7, child number 0
-------------------------------------
select /*+leading(t2)use_merge(t1)*/*   from t1, t2  where t1.id =
t2.t1_id   and t1.n =19

Plan hash value: 1792967693

-----------------------------------------------------------------------------------------------------------------
| Id  | Operation           | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
-----------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT    |      |      1 |        |      1 |00:00:00.04 |    1012 |       |       |          |

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|   1 |  MERGE JOIN         |      |      1 |      1 |      1 |00:00:00.04 |    1012 |       |       |          |
|   2 |   SORT JOIN         |      |      1 |  98810 |     20 |00:00:00.04 |    1005 |  9762K|  1209K| 8677K (0)|
|   3 |    TABLE ACCESS FULL| T2   |      1 |  98810 |    100K|00:00:00.01 |    1005 |       |       |          |
|*  4 |   SORT JOIN         |      |     20 |      1 |      1 |00:00:00.01 |       7 |  2048 |  2048 | 2048  (0)|
|*  5 |    TABLE ACCESS FULL| T1   |      1 |      1 |      1 |00:00:00.01 |       7 |       |       |          |
-----------------------------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   4 - access("T1"."ID"="T2"."T1_ID")

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
       filter("T1"."ID"="T2"."T1_ID")
   5 - filter("T1"."N"=19)

Note
-----
   - dynamic statistics used: dynamic sampling (level=2)


29 rows selected.

SQL> 

嵌套循环连接和散列连接有驱动顺序,驱动表的顺序不同将影响表连接的性能,而排序合并连接没有驱动的概念,无论哪张表在前都无妨。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/184341.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【SpringCloud】Gateway服务网关的基本使用

一、初识Gateway服务网关为什么需要网关&#xff1f;在微服务中&#xff0c;各个模块之间的调用&#xff0c;也可以称其为远程调用&#xff01;但是&#xff0c;如果是外部&#xff08;用户&#xff09;对微服务进行访问时&#xff0c;发的请求能不加处理的直接访问微服务吗&am…

使用Client Java构建Exporter程序

一、client_java client_java是Prometheus针对JVM类开发语言的client library库&#xff0c;我们可以直接基于client_java用户可以快速实现独立运行的Exporter程序&#xff0c;也可以在我们的项目源码中集成client_java以支持Prometheus。注意&#xff1a;Prometheus 提供的cl…

WordPress默认数据库中的12个数据表

WordPress 安装的时候数据库会有 12 张默认的数据表&#xff0c;每张表的数据都包含了 WordPress 不同的功能。看看这些表的结构&#xff0c;你能很容易的了解网站不同的部分都是存在哪里的。目前&#xff0c;默认的 WordPress 安装会创建如下12个数据表。表名描述wp_users您的…

大数据在5G应用场景下有哪些示范项目?

近期&#xff0c;贵州省2022年5G应用场景示范观摩会在贵阳召开&#xff0c;此次观摩会由贵州省大数据发展管理局、贵州省通信管理局主办。数据宝“基于5G技术的交通国有大数据治理多元应用”获得贵州省5G应用场景示范项目&#xff08;五星&#xff09;称号。 据悉&#xff0c;…

二叉树(二)

前言本章我们继续了解二叉树。上文我们对树和二叉树有了简单的了解&#xff0c;详见二叉树&#xff08;一&#xff09;这里我要解释一下为什么我们不对树进行增删查改呢&#xff1f;答案是&#xff1a;没有意义。我们更应该把有限的精力用作有意的地方&#xff0c;那么我们今天…

TLS协议。

IPSec通过安全关联实现IP分组安全关联两端之间的安全传输过程&#xff0c;TLS通过建立安全连接实现数据在两个应用进程之间的安全传输过程。TLS建立安全连接时&#xff0c;实现安全连接两端应用进程之间的双向身份鉴别过程&#xff0c;保证经过安全连接传输的数据的保密性和完整…

【GPLT 二阶题目集】L2-017 人以群分

社交网络中我们给每个人定义了一个“活跃度”&#xff0c;现希望根据这个指标把人群分为两大类&#xff0c;即外向型&#xff08;outgoing&#xff0c;即活跃度高的&#xff09;和内向型&#xff08;introverted&#xff0c;即活跃度低的&#xff09;。要求两类人群的规模尽可能…

时间序列模型

一、季节分解 1、概念 时间序列也称为动态序列&#xff0c;是指将某种现象的指标数值按照时间顺序排列而成的数值序列。主要由时间要素和数值要素构成。时期序列中&#xff0c;数值要素反映现象在一定时期内发展的结果&#xff1b;时点序列中&#xff0c;数值要素反映现象在一…

如何在FreeBSD中安装Nginx,MySQL,PHP(FEMP)

本文介绍如何在FreeBSD 13系统中安装Nginx、MySQL、和PHP服务。系统环境FreeBSD 13.0-RELEASE更新系统在安装任何软件之前更新系统是一个好习惯&#xff0c;以便检查系统更新&#xff1a;rootfreebsd:~ # freebsd-update fetchrootfreebsd:~ # freebsd-update install安装Nginx…

在线教育-谷粒学院学习笔记(九)

文章目录1 内容介绍2 搭建项目前台环境NUXT3 整合项目首页4 nuxt路由5 首页数据banner显示—初始配置6 首页数据banner显示—接口7 首页数据banner显示—前端实现8 首页数据显示—热门课程和名师9 Redis复习10 首页数据添加Redis缓存1 内容介绍 搭建项目前台系统环境 NUXT 整合…

【PHP 随记】—— Composer 安装及镜像配置

&#x1f449;总目录&#x1f448;\large\colorbox{skyblue}{&#x1f449;总目录&#x1f448;}&#x1f449;总目录&#x1f448;​ 文章目录1、Composer 安装2、配置镜像Composer 是 PHP 用来管理依赖&#xff08;dependency&#xff09;关系的工具&#xff1b;简单来说&…

等级保护介绍

等保流程 等级保护 等保发展历程 。1994 首次国家提出等级保护概念 。1999 针对信息系统保护有法律依据 。2007 等保1.0措施。 。2017 立法了《网络安全法》 。2019年 等保2.0 颁布 等保2.0和1.0有什么特点和区别 1.名称变了信息安全技术信息等级保护要求 改为 信息安全基础网络…

1、测试用例通用模板

一、针对大版本需求的测试用例模板 1、测试用例模板说明 1.1、表头说明 项目版本号V1.0--测试用例&#xff08;示例标题&#xff09;(xxxxx有限公司测试组/ONLY FOR INTERNAL USE ONLY)Confidentiality level 密级(xxxxxx测试组/仅供内部使用) Internal 内部公开 修订记录版…

软件设计(二)

软件设计&#xff08;一&#xff09;https://blog.csdn.net/ke1ying/article/details/128779601 11、windows系统当双击.jpg文件的时候&#xff0c;系统会通过建立的 文件关联 来决定使用什么程序来打开该图像文件。 &#xff08;双击.jpg文件&#xff0c;系统会建立‘window…

【哈希表】leetcode349. 两个数组的交集(C/C++/Java/Python/Js)

leetcode349. 两个数组的交集1 题目2 思路--set2.1 拓展/后记3 代码3.1 C版本3.2 C版本3.3 Java版本3.4 Python 版本3.5 JavaScript版本4 总结1 题目 题源链接 给定两个数组 nums1 和 nums2 &#xff0c;返回 它们的交集 。输出结果中的每个元素一定是 唯一 的。我们可以 不考…

分享150个ASP源码,总有一款适合您

ASP源码 分享150个ASP源码&#xff0c;总有一款适合您 下面是文件的名字&#xff0c;我放了一些图片&#xff0c;文章里不是所有的图主要是放不下...&#xff0c; 150个ASP源码下载链接&#xff1a;https://pan.baidu.com/s/1DpxbFxdGCl9eWEe3AaD1eA?pwdecqi 提取码&#x…

echarts数据可视化项目搭建(二)

目录主题设置默认主题重点示例自定义主题调色盘主题全局局部颜色渐变可视化图表自适应重点示例实现简单的加载动画重点示例增量动画实现重点示例简单动画配置项关于全局echarts对象和echartsInstance对象echarts.connect()其他echarts实例对象方法本博客内容参考黑马课程&#…

系统编程中的进程的概念No.2

引言&#xff1a; 今天是个好日子&#xff0c;日更动态养成习惯&#xff0c;日更博客你我他&#xff0c;北京时间 2023/1/29/10:09&#xff0c;今天阳光明媚&#xff0c;但是还是很冷&#xff0c;起床时间8:55&#xff0c;可以看出又早了那么一点点&#xff0c;今天为什么能起…

VSCode调试Python文件并指定虚拟环境

记录在使用VSCode调试py文件时遇到的一些问题&#xff1a;1.启用Debug模式进行调试2.调试带参数的python文件3. 调试时指定服务器虚拟环境4. 相对路径出错首先给出VScode 官方调试说明&#xff1a;https://code.visualstudio.com/docs/python/debugging#_set-configuration-opt…

法律常识(六)《最高人民法院婚姻法司法解释精释精解》例子

目录 一、婚约财产&#xff08;彩礼&#xff09;纠纷 二、夫妻共同债务中违法债务的审查认定 三、夫妻之间也可以成立借贷关系 四、一方未经另一方同意出售夫妻共同共有的房屋 五、夫妻一方婚前财产投资所得的归属 六、夫妻间房产赠与协议的效力认定 七、婚内财产分割的…