Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

sql in clause Vs Union

User_BGC7SJul 6 2022

This is a weird question
We lately moved to exadata (do not know if relevant.
I am running a simple select query with a in clause. lets say:
----------
select a, b
from myTable
where request_id in (-100, 100)
--------
it takes between 0.3 (the best of the best) to 90 seconds to return an answer
This table contain around 9 BILLION rows
the index are working great because when I do
select a, b
from myTable
where request_id = 100
union
select a, b
from myTable
where request_id = -100
it takes lest then 0.01 second constantly

Any idea?

Comments

Post Details

Added on Jul 6 2022
6 comments
384 views