1. the subquery is not delegated to the source because it is executed from dual().
2. when we execute this full query, it is loading more than 2ml records first (Reason for query timeout) and then it applies the subquery logic in where condition.
So, the question is, is there anyway to get executed the sub query first and then the main query applies filter? Is there any other logic to help here? Consumer application is Tableau and if any solution to consumer app will also appriciated?
select * from dw_vdb.cib360_bv_daily
where as_of_date in (select case getdayofweek(current_date)
then addday(current_date, -4)
then addday(current_date, -3)
else addday(current_Date, -2) end)
Need exact solution for this use case. Appriciated for your help