Re: Limit SQL execution for specific SQL IDs
Narendra, July 09, 2025 - 4:20 pm UTC
Thank you Chris for your response.
Unfortunately it is a packaged application so no option of using module/action without a change. Also my case is about SQL ID using same execution plan but having different response times due to skew in underlying data.
My intention is to find a way to limit/affect only long-running executions but allow other executions of a specific SQL ID (with specific execution plan) without making changes to application code, if there exists one (something like what sql patch/sql profile/sql plan baselines do)
Thanks in advance
July 09, 2025 - 4:35 pm UTC
How slow does the query get compared to other queries where it's expected and OK for them to run for a long time? i.e. can you set a blanket query limit for the app using Resource Manager without impacting reporting or other long-running queries?
If not, I'm not aware of other out-of-the-box methods. You could roll your own by having a job that checks v$session for sessions that have been running this SQL id for some time and run alter system cancel SQL on them.
To Narendra
J. Laurindo Chiappa, July 09, 2025 - 6:37 pm UTC
July 10, 2025 - 10:32 am UTC
Good suggestion
Narendra, July 10, 2025 - 8:36 am UTC
How slow does the query get compared to other queries where it's expected and OK for them to run for a long time? i.e. can you set a blanket query limit for the app using Resource Manager without impacting reporting or other long-running queries?
If we are able to set a blanket query limit for the app using Resource Manager (and it will have to be very high to begin with to ensure no disruption), is there a way I can limit execution time for this specific SQL ID? For this specific SQL ID, the expectation is that any execution that completes within 5 seconds should be allowed bu anything over 5 seconds should be cancelled, without affecting any other SQL IDs
July 10, 2025 - 10:30 am UTC
Not that I'm aware of - as you've noted, Resource Manager isn't that granular.