dt4233 2015-04-22 13:35
浏览 57

PHP中的Mysql查询挂起3000+结果

I have a query that ran perfectly fine up until 2 days ago. It queries a remote database getting quiz data for a couple thousand students. Normally the result set is around 10000 rows.

2 days ago, the script started hanging and I've tracked it down to this query:

mysql_query("SELECT qg.userid, ROUND( qg.grade * 100 / q.grade, 2 ) grade, q.grade as qgrade, q.id quizid, qg.timemodified FROM mdl_quiz_grades qg, mdl_quiz q WHERE q.id = qg.quiz AND q.course = 47 And q.id in (-1,153,158,163,170,176,181,184,199,205,206)  Order By userid, quizid

limiting results to 3000 is fine, and it executes immediately, but if limited to 3001 it hangs without finishing.

Also I can execute the query in phpMyAdmin with no problem.

Edit: The results limit has been changing. I was just able to get a return of 3700 results and now can no longer.

Edit2: More testing in phpMyAdmin. When accessing records from the 3000+ range, phpMyAdmin will hang and eventually throw a 500 internal server error.

Edit3: Well. testing is suspended. The Remote Database has just started using SSL for database connections, so my previous user isnt working. I now need to configure my client for SSL. I'm guessing they were making adjustments through the week that was screwing with my script.

  • 写回答

2条回答 默认 最新

  • doudun6928 2015-04-22 13:51
    关注

    Two possibilities:

    1. Are you able to fetch at least 1 record?

    2. Try increasing the max_execution_time in your php.ini file

    3. Change memory limit to 128M if it is low

    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?