Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

composite primary key query performance issue

Nandhini KMay 29 2024

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.

Comments
Post Details
Added on May 29 2024
1 comment
124 views