We have had a performance problem on a particular APEX screen, ever since we had to perform a Dataguard failover 10 days ago. I'd put it down to general system load until I investigated more deeply today. The Underlying SQL runs fine, running as the same user, via SQL (<0.1 seconds). Via the application, using the same bind variables it takes > 70s. What is really confusing me is the dbms_xplan output is stating
- rule based optimizer used (consider using cbo)
in the report. I didn't think that was even possible any more? I'll raise an SR if needed, but before I go down that rabbit hole, has anyone seen this before? Any idea where to look? We did manage to lose a couple of parameters on the failover, I thought I'd found them all but maybe not? It's not a global problem though, most things are working fine. Application hasn't changed in ages according to the DEV team.
Any suggestions, gratefully received!
dbms_xplan
that you used. It's important to get the plan that's actually performing poorly and not a different one, so how you call this matters. Also show us any hints in the query (ensure it doesn't have theRULE
hint). Also share the output ofSELECT value FROM v$parameter WHERE name = 'optimizer_mode'
. Also, FYI, if you do use bind variables testing manually cannot be done simply by replacing teh binds with literals - that's a different SQL and may take different plan. You'd have to mock up the SQL with real binds using a small PL/SQL block to test.display_cursor
. I suspect that either your APEX program is alteringoptimizer_mode
in its session or including theRULE
hint in the query. You shouldn't be seeing the RBO in use otherwise. Also note what I said above about mocking up a test using PL/SQL so you can use real binds for your performance tests.