Posted: Tue Feb 24, 2015 1:46 am Post subject: Optimizing a DISTINCT query
Here is the query I'm trying to run -
SELECT DISTINCT A.Field1, A.Field2, A.Field3
FROM Creator.Table1 A, Creator.Table2 B
WHERE A.Field4 = 'LA'
AND A.Field5_1 = B.Field5_2 [Field 5_1 : of Table1, Field 5_2 : of Table2]
AND A.Field6 = 0
AND B.Field7 IN ('1,'2','3','4','5')
AND A.Field8 IN ('11','12','13','14','15)' WITH UR;
But regardless of whether I run it through QMF or a Batch Job, I get a time-out.
Please suggest ways of improving this query.
I also tried the same by removing DISTINCT, still no success.
Note : Both the tables have a huge volume of data. _________________ Logically yours,
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum