Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Immediately exit a query if a condition is verified - response (4) by gxgxg

$
0
0

 
Thank you for your answer,
it works correctly indeed! But, since the whole query needs about 30minutes to run, even though the condition you posted is not satisfied it keeps executing the entire query (so, 30min), and after that it correctly outputs 0 rows.
But, I'd like that, when the condition you posted is false, it gives 0 rows in less than 1 minute (instead of 30mins). So such that if the condition is false it does not need to compute the whole query and it just exits.
 
So my current query is like this:

WHERE (my current conditions)

 
and it runs in about 30mins.
 
If I try to do this:

WHERE 1 = 0

AND (my current conditions)

 
it runs in 1 second and does not evaluate all other conditions!
 
But if I try

WHERE (CURRENT_DATE - DATE '0001-01-01') MOD 7 = 0

AND (my current conditions)

 
it runs in about 25 minutes, which is less than 30mins, but far away from what I'd like to have (<1minute).
 
I hopeI made myself clear! Is that possible to archieve?
Thank you very much again


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>