qry tune with ranking function

Database
Enthusiast

qry tune with ranking function

I am runing this qry on a 500gb table but this seems to be using 4TB of spool space, wanted to check whats wrong 

 

SyntaxEditor Code Snippet

SELECT *
    FROM RevDGT.NumFrqnce ro 
QUALIFY    COUNT ( * ) OVER ( PARTITION BYro.ssn, ro.ssn_inrc.rev_num ,
    ro.revnum_et , ro.cd_value ) > 1;

 

1 REPLY
Teradata Employee

Re: qry tune with ranking function

Perhaps one or more of your PARTITION BY columns is a VARCHAR with a large max length - variable length columns are expanded to the max length in spool for sorting.

 

Or your table may have Block-Level Compression applied while the spool does not.