zoukankan      html  css  js  c++  java
  • group by 替代distinct

    SQL> select distinct employee_id,first_name from test1;
    
    107 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 255531131
    
    ------------------------------------------------------------------------------------
    | Id  | Operation	   | Name  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time	   |
    ------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |	   |  6647K|   158M|	   | 67481   (1)| 00:13:30 |
    |   1 |  HASH UNIQUE	   |	   |  6647K|   158M|   229M| 67481   (1)| 00:13:30 |
    |   2 |   TABLE ACCESS FULL| TEST1 |  6647K|   158M|	   | 19570   (1)| 00:03:55 |
    ------------------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    
    Statistics
    ----------------------------------------------------------
    	  4  recursive calls
    	  0  db block gets
         142133  consistent gets
          71297  physical reads
    	  0  redo size
           2749  bytes sent via SQL*Net to client
    	496  bytes received via SQL*Net from client
    	  9  SQL*Net roundtrips to/from client
    	  0  sorts (memory)
    	  0  sorts (disk)
    	107  rows processed
    
    
    SQL> select employee_id,first_name from test1 group by employee_id,first_name;
    
    107 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1431305903
    
    ----------------------------------------------------------------------------
    | Id  | Operation	   | Name  | Rows  | Bytes | Cost (%CPU)| Time	   |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |	   |  6647K|   158M| 19781   (2)| 00:03:58 |
    |   1 |  HASH GROUP BY	   |	   |  6647K|   158M| 19781   (2)| 00:03:58 |
    |   2 |   TABLE ACCESS FULL| TEST1 |  6647K|   158M| 19570   (1)| 00:03:55 |
    ----------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    
    Statistics
    ----------------------------------------------------------
    	  4  recursive calls
    	  0  db block gets
         142133  consistent gets
          71297  physical reads
    	  0  redo size
           2749  bytes sent via SQL*Net to client
    	496  bytes received via SQL*Net from client
    	  9  SQL*Net roundtrips to/from client
    	  0  sorts (memory)
    	  0  sorts (disk)
    	107  rows processed

  • 相关阅读:
    Python reportlab table 设置cellstyle枚举,设置单元格padding
    代理工具 v2ra*的使用
    python 开发环境需要安装
    postgres 新增或者更新语句
    python psycopg2 查询结果返回字典类型
    postgres 多个字段匹配查询
    django 执行原生sql形参传递,字段参数传递
    亚马逊接口调用
    python x 开头的字符转码为中文
    postgres 定义变量
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3798106.html
Copyright © 2011-2022 走看看