title: mysql takes 50+ times longer to return 20% more records, why?
body: <p>I am using a program that I downloaded and don't have all the details.  This is a web app (Python CGI) that takes user input and queries the mysql database.  What I do know is that when I limit the recordset to 100 results (in the app setting), the results are returned within 2 seconds.  But if I increase the limit just slightly to 120, then it will take over 1.5 minutes to process!  I've tried with several different queries and they all succumb to this problem. This is mind boggling.  Without knowing exactly how the querying is implemented, are there some general mysql settings that I should look into that might mitigate this problem?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>After more testing, I found that 107 is the magic number that causes this performance problem.  Anything below 107 records returns instantly, whereas anything >= 107 takes at least 1.5 minutes or timing out as it gets bigger.</p>