Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I am working on an MVC ASP.NET web application which centers around lots of data and data manipulation.

PROBLEM OVERVIEW: We have an advanced search with 25 different filter criteria. I am using a stored procedure for this search. The stored procedure takes in parameters, filter for specific objects, and calculates return data from those objects. It queries large tables 14 millions records on some table, filtering and temp tables helped alleviate some of the bottle necks for those queries.

ISSUE: The stored procedure used to take 1 min to run, which creates a timeout returning 0 results to the browser. I rewrote the procedure and got it down to 21 secs so the timeout does not occur. This ONLY occurs this slow the FIRST time the search is run, after that it takes like 5 secs.

I am wondering should I take a different approach to this problem, should I worry about this type of performance issue if it does not timeout?

share|improve this question
Yes - you should address error conditions. dba.SE would be the ideal place to get help with performance tuning the SQL though. – James Snell Jul 2 '13 at 15:07
up vote 2 down vote accepted

No, you don't need to worry about a problem that isn't occurring. If your query isn't timing out or running unacceptably slow, you can allocate your time elsewhere.

If you are allowing very complex queries, the question of why you are not allowing slightly sanitized SQL arises. And if you allow arbitrary select statements, then how you handle timeouts and errors and cancellations becomes more important than the performance of your gui-sourced sql.

I've seen and worked with web apps that don't allow direct sql even for competent users, and the results have always been disappointing. Empowerment lets you handle the edge cases from a design perspective, and focus your attention on where it can get the most benefit instead of doing a user's work for them all the time.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.