签到成功

知道了

CNDBA社区CNDBA社区

Orcle 12c 新特性---Approximate Count Distinct

2017-08-06 10:01 2039 0 原创 Oracle 12C
作者: Expect-乐

 说明

The new and optimized SQL function, APPROX_COUNT_DISTINCT(), provides approximate count distinct aggregation. Processing of large volumes of data is significantly faster than the exact aggregation, especially for data sets with a large number of distinct values, with negligible deviation from the exact result.http://www.cndba.cn/Expect-le/article/2060

对大量数据的处理比精确的聚合要快得多,特别是对于具有大量不同值的数据集,与精确结果的偏差可以忽略不计。

The need to count distinct values is a common operation in today's data analysis. Optimizing the processing time and resource consumption by orders of magnitude while providing almost exact results speeds up any existing processing and enables new levels of analytical insight.

这个功能对于如今的数据分析用处非常大,又可以提供几乎精确的结果。关键是处理速度是非常之快。

http://www.cndba.cn/Expect-le/article/2060

注意:BFILE, BLOB, CLOB, LONG, LONG RAW, or NCLOB数据类型除外。并且会忽略包含空值的列。

http://www.cndba.cn/Expect-le/article/2060

例如:http://www.cndba.cn/Expect-le/article/2060

--正常查看不同object_name的总数

http://www.cndba.cn/Expect-le/article/2060
http://www.cndba.cn/Expect-le/article/2060
http://www.cndba.cn/Expect-le/article/2060

http://www.cndba.cn/Expect-le/article/2060

15:39:31 SQL> select count(distinct(object_name)) from cndba_t;

COUNT(DISTINCT(OBJECT_NAME))
---------------------------
       67455

Elapsed: 00:00:00.64

---使用APPROX_COUNT_DISTINCT()


15:39:36 SQL> select APPROX_COUNT_DISTINCT(object_name) from cndba_t;

APPROX_COUNT_DISTINCT(OBJECT_NAME)
----------------------------------
     67063

Elapsed: 00:00:00.14

http://www.cndba.cn/Expect-le/article/2060

可以看到时间差别还是比较大的,数量级的差距。数据量越大,不同值越多,差距越明显。

参考文档:http://www.cndba.cn/Expect-le/article/2060

http://docs.oracle.com/database/121/SQLRF/functions013.htm#SQLRF56900

版权声明:本文为博主原创文章,未经博主允许不得转载。

Approximate Count Distinct

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
Expect-乐

Expect-乐

关注

Without the continuous bitter cold, there can be no fragrant plum blossom

  • 336
    原创
  • 6
    翻译
  • 100
    转载
  • 41
    评论
  • 访问:1570121次
  • 积分:1957
  • 等级:核心会员
  • 排名:第4名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ