I know that in SO is lot of this kind of topics, but would like to introduce to my concrete example.
When running action from web app (ADO.NET, ASP.NET MVC) getting error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server. The wait operation timed out
But from the second hand when running directly on db raw query (captured by profiler) taking only 2 seconds.
Background:
- Issue appear suddenly (week after release) and occurring only in prod server.
- Timeout for this specific query is 180 sec, for http requests is 24000 [units] - probably also seconds (per MSDN)
- We have no full text indexes
- Error occurring only for one specific query when user search by one "fretext" (normal textbox) field what generating the query with additional 10-12 "or like %value%" conditions (the way how it was done from the begin, and have no chance to change it)
- What is strange very similar queries (for others "freetext" fields with the same amount of "or like %value%") working without any problems
- Transaction isolation level = Serialized
- Data binding is done in the same way for each query (controller->service->db->service->view model->html), actually our framework automatically binding fields from "select" query to viewModels
- Raw query (captured by profiler) running quickly (2-3 secounds) but from webApp level returning timeout.
- I have no direct access to prod server, so im not able to check everything immediately, also i can not share any code/stacktraces.
Advices:
Found lot similar posts, this one looks especially interesting for me: https://stackoverflow.com/a/8603111, and wondering about clearing statistics (exec sp_updatestats).
Question:
Do you have similar experiences, maybe any others advices as suggested above? What can be the reason that raw query running in short time, but from webapp getting timeout?