Orcle 12c new features --- APPROX_COUNT_DISTINCT

1 Description

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.

Processing large amounts of data much faster than the polymerized exactly, especially for large data sets having different values ​​of deviation from the exact result can be negligible.

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.

This feature is useful for today's data analysis is very large, and can provide almost accurate results. The key is the processing speed is very fast.

Note: except BFILE, BLOB, CLOB, LONG, LONG RAW, or NCLOB data type. And ignores the column contains a null value.

2 For example:

- normal view of the total number of different object_name

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

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

Elapsed: 00:00:00.64

- Use 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

You can see the time difference is quite large, the magnitude of the gap. The larger the amount of data, the more different values, the more obvious gaps.

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

Guess you like

Origin blog.csdn.net/qianglei6077/article/details/92979346