Kathryn Gamble, March 09, 2025 - 8:46 am UTC
Thanks.
My scenario is
Container 1: connected as Scott:
T1_gtt And t2 contain approx 2000 rows each
Select * from t1_gtt a
Join T2 b on a.c1 = b.c1
Where a.c2= :1
;
Container 1: connected as tiger (i.e. different schemas)
T1_gtt and T2 contain millions of rows
Select * from t1_gtt a
Join T2 b on a.c1 = b.c1
Where a.c2= :1
;
I.e different schemas with same table structure.
If the data is different, is it possible that scenario 2 would use the execution plan generated for scenario 1. Which may not be optimal for scenario 2.
We are seeing huge differences (minutes to hours) in execution time for scenario 2 day to day even though data volumes are consistent in each scenario and gather_table_stats is done before the query in each scenario.
If we modify the query in scenario 2 to force a parse (different sql_id), the execution time is back to minutes again.
I had thought that because the queries are in different containers and schemas, the optimise would not reuse the execution plan from another container and schema.
If it does reuse it, would I need to force a reparse in scenario 2 in order to get the most optimal plan for the larger data volumes?
.
March 10, 2025 - 3:49 am UTC
If the data is different, is it possible that scenario 2 would use the execution plan generated for scenario 1. Which may not be optimal for scenario 2.
No. Notice the two different children cursors in my first response. This means they could not be shared. Each cursor points to its own plan
(In my example, the fact that they landed on the same plan was because everything was identical).
Kathryn Gamble, March 10, 2025 - 5:13 am UTC
Thanks very much for the clarification.
March 20, 2025 - 2:00 am UTC
glad we could help