This behavior is random but frequent.
Background on query :
Below query is executed using vsql command and run as unix korn job
table1, table2, table3 and table4 are populated using another unix kron job.
SELECT
primary_id
,b
,w
,c FROM (
SELECT
primary_id
,b
,w
,c
,r
FROM table1
JOIN table2
JOIN table3
) sub WHERE r=1
AND primary_id IN (SELECT DISTINCT primary_id FROM table4 )
GROUP BY primary_id ,b, w,c
Any pointers are appreciated, Thanks in advance