I am running a simple select query which is part of a bigger code. The query is given below:
SyntaxEditor Code Snippet
select event_id,agrmnt_id, ,card_no,mrchnt_nm from view.data_view where event_pl<0 and bi_am is not null and card_no is not null and event_start_dt between ADD_MONTHS(DATE, -13) AND DATE and source_start_dt between ADD_MONTHS(DATE, -13) AND DATE ;
The view data_view is a view within a view on a large table (14 TB) approximately. I have checked the explain plan
and there is no data redistrubtion or duplication. Since there is no join in the query. As per the explain plan it
takes upto 559 GB of spool. Is there any way we can reduce the spool usage in the above query?
Is the 14TB table skewed at all?
SUM(CURRENTPERM) /(1024*1024) AS CURRENTPERM,
(100 - (AVG(CURRENTPERM)/MAX(CURRENTPERM)*100)) AS SKEWFACTOR
WHERE DATABASENAME= <DATABASENAME>
AND TABLENAME =<TABLENAME>
GROUP BY 1;