In my scenario, the following query runs fast (0.5 seconds on a table with 70 million rows):
select * from Purchases
where (purchase_id = 1700656396)
Just a quick question: I guess the following non-parameterized query will also run for 1.5 minutes?
select * from Purchases
where (1700656396 IS NULL OR purchase_id = 1700656396)
and ('some-name' IS NULL OR purchase_name = 'some-name')
and (12 IS NULL OR purchase_price = 12)
If yes, the problem is not the bind variables but the lack of indexes.
EDIT The problem is, Oracle cannot decide to use the index when generating the plan for the parametrized query