So I can’t remember my password at the Oracle sites, and My email is too jacked up to get a reset, so I was hoping someone here might be able to help.
To simply distill the essence of my problem, since the actual data model would take hours to explain.
Lets say I have a base data type of WIDGET. I have a base table of T_WIDGET with a primary key of WIDGET_ID and other data. I have hundreds of other tables foreign keyed to use WIDGET_ID.
SO I created a view that returns rows of key data for one type of OLTP transactions V_CALC_KEY_WIDGET_DATA, with the foreign Key of WIDGET_ID.
If I write
Select * from V_CALC_KEY_WIDGET_DATA where widget_id = 500;
it returns quickly and has an explain plan cost of 2600.
But if I have anything other than a literal numeric value it blows the hell up.
Even a stupid simple tautological subquery is absurd.
for example
Select * from V_CALC_KEY_WIDGET_DATA where widget_id =
(select WIDGET_ID from T_WIDGET where WIDGET_ID = 500);
takes over 24 hours(never finished it) and has a plan cost of 45 billion.
Does anyone know how to instruct oracle to finish run the damn subquery and treat the return value as it does a literal using the same lookup plan?
A subquery isn’t really the main way I’d normally write it, but it seemed the best way to explain it here. But everything I try; joins, joins with WITH clauses, functions that return a number all have the same issue. It’s wants to build the entire V_CALC_KEY_WIDGET_DATA for millions of widgets doing millions of table scans before picking out the rows for the single widget I need.
Thanks, before I go crazy.