大型查询时MySql超时

时间:2017-02-21 23:23:05

标签: php mysql sql

我在SO上搜索了这个主题,似乎无法找到一个解决方案。我正在运行一个大约7秒超时的查询。我托管网站上的错误日志是:

proportions <- table(your_data_frame$gender_columnn)/length(your_data_frame$gender_column)
percentages <- proportions*100

我的剧本:

[21-Feb-2017 18:11:20 America/New_York] PHP Notice:  Undefined index: action in /home/public_html/county-vol.php on line 12
[21-Feb-2017 18:11:28 America/New_York] PHP Warning:  mysqli_query(): MySQL server has gone away in /home/public_html/county-vol.php on line 22
[21-Feb-2017 18:11:28 America/New_York] PHP Warning:  mysqli_query(): Error reading result set's header in /home/public_html/county-vol.php on line 22

只有在我向查询添加<?php //ini_set('max_execution_time', 0); ini_set('mysql.connect_timeout', 14400); ini_set('default_socket_timeout', 14400); $link=mysqli_connect("localhost","database","password","tech_training"); if (mysqli_connect_errno()){ echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $query="SELECT u.UserName, u.LastName, u.Affiliation, (e.UserName IS NOT NULL) as completed FROM UsersDataTbl u LEFT JOIN EnrollmentsTbl e ON u.UserName = e.UserName AND e.ClassName LIKE 'Word%' WHERE u.Career = 0 AND u.Active = 1 ORDER BY u.LastName"; $result=mysqli_query($link,$query) or die ("Vol Querystring Error"); $json = mysqli_fetch_all ($result, MYSQLI_ASSOC); echo json_encode($json ); ?> 时才会超时?我没有请求更大的数据集,只是添加了一个字段。我知道这个字段很好,因为它出现在phpMyAdmin中,但我也无法在phpMyAdmin中成功运行SQL(我从过去知道phpMyAdmin超时仍然可以在PHP中运行的大型查询)

我也尝试过添加:

u.Affiliation

EDIT / UPDATE:

如果我通过将ini_set('max_execution_time', 0); ini_set('mysql.connect_timeout', 14400); ini_set('default_socket_timeout', 14400); 添加到WHERE子句来缩小返回的记录 - 它会返回所需的结果......那么是否对返回的记录数量有限制?

0 个答案:

没有答案