When I am exporting a table from teradata using BTEQ, the output row count does not match the select query count. The following is the warning shown by BTEQ
Warning: The activity count returned by DBS does not match
the actual number of rows returned.
Activity Count=495294, Total Rows Returned=495286
Here is the select query,
SELECT CUST_ID, SPEC1_CODE FROM Table
GROUP BY 1,2
Here is the create table script,
CREATE MULTISET TABLE Table ,NO FALLBACK ,
NO BEFORE JOURNAL,
NO AFTER JOURNAL,
CHECKSUM = DEFAULT
(
RECORD_KEY DECIMAL(20,0) NOT NULL,
CUST_ID VARCHAR(40) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL,
SPEC1_CODE VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC)
PRIMARY INDEX ( RECORD_KEY );
When we contacted Teradata support, they asked us to run the following query.
DIAGNOSTIC NOAGGRENH ON FOR SESSION;
So, if we run the above query and then run our select/BTEQ export, it is working fine.
I was hoping you would answer my questions in the comment sooner but I’m going to throw this out as a possible reason for the discrepancy you are seeing in the warning message.
Your table is defined as MULTISET with a non-unique primary index or possibly as a NOPI table in Teradata 13.x. There are no additional unique constraints on the table or unique indexes. The table has been loaded with 8 duplicate rows of data.
For reasons that I can not pinpoint based on your description BTEQ returned a unique set of records although the optimizer indicates that the activity count for the statement was greater. Thus the warning message that you are seeing.