Skip to content
Advertisement

sql query hangs/times out when passed large data

UPDATED: Guys I am passing list of faculty id’s to stored procedure, when i pass more than 10 faculty id’s it’s taking long time to process the data and sometime times out. I spent good amount of time on debugging this query and find out the last line in proc is causing query to timeout/slow response time. The last line is subquering from CTE. How to I rewrite/optimize last line of the proc to make my query run faster. Any help will be highly appreciated. Can someone help on this please.

Advertisement

Answer

You can try using the /*+ MATERIALIZE */ hint on the faculty_list with clause sub query. In general, I’d say the performance would mostly depend on if student.faculty_code is indexed, you can add to this index the grade

If you have this index and the materialize hing, then you have the optimal chance of this performing well. The following works for null input list as well:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement