Count_big after Big Data summation

Source: Internet
Author: User

Yesterday, I ran into a query with two result sets. The query took nearly 8 points and it was still being queried.

Check the total data one by one to test the result set. An error is returned:

Message 8115, level 16, status 2, 1st rows
Arithmetic overflow error converting expression to data type Int.

At first glance, it is beyond the type, but the storage below is much smaller than the int data volume. Baidu, it turns out that the data volume requested by count exceeds the total number of int types.

Count_big always returnsBigintData Type value. Count always returnsIntData Type Value

Syntax
 
Count_big({[All | distinct]Expression} | *) 
Parameters
All

Performs aggregate function operations on all values. All is the default value.

Distinct

Specifies the number of unique non-null values returned by count_big.

Expression

Is an expression of any type. Aggregate functions and subqueries are not allowed.

*

Specify that all rows should be calculated to return the total number of rows in the table. Count_big (*) And cannot be used with distinct. Count (*) Not requiredExpressionParameter, because according to the definition, this function does not use information about any specific column. Count_big (*) Returns the number of rows in the specified table and counts the repeated rows. It counts each row separately. Contains rows that contain null values.

Return type

Bigint

Remarks

Count_big (*) returns the number of items in the group. Including null values and repeated items.

Count_big (allExpression) Is calculated for each row in the group.ExpressionAnd return the number of non-null values.

Count_big (distinctExpression) Is calculated for each row in the group.ExpressionAnd return the number of unique non-null values.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.