i am using pyspark to read data from huge oracle table which have composite primary key(lets say id1,id2)
below query giving timeout or long run
id1 in (1,2,3,4 and so on) and id2 in (10,20)
below query running fine
select * from table where id1=1 and id2 in (10,20)
union all
select * from table where id1=2 and id2 in (10,20)
union all
select * from table where id1=3 and id2 in (10,20)
union all
select * from table where id1=4 and id2 in (10,20)
Any suggestion to overcome this without using union all of all ids.