laravel 从 MySQL 数据库中选择 300,000 行时出现 504 网关超时错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40239537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:39:27  来源:igfitidea点击:

504 Gateway Timeout error while selecting 300,000 rows from MySQL database

mysqlsqllaravel

提问by Shahid Ahmad

I have a table orders with 30000rows. I am using Linode Server with 2GB RAM

我有一个 30000 行的表订单。我正在使用带有 2GB RAM 的 Linode 服务器

but when i executed my query using phpmyadmin it give me 504 Gatetimeout Error

但是当我使用 phpmyadmin 执行我的查询时,它给了我 504 Gatetimeout 错误

SELECT * FROM `orders`

I don't understand what's is the problem? i am getting that error you can see the image below

我不明白有什么问题?我收到那个错误你可以看到下面的图片

enter image description here

在此处输入图片说明

回答by Aleksej

Get 30k records at ones - it isn't a good idea, any way, you need to check your sql server configuration, 30k records isn't enough to get over default timeout. B/w if u just change timeout in web server it does not affect you b/c browsers have a default timeout to. Probably mysqltunercan help you to find configuration error.

立即获取 30k 条记录 - 这不是一个好主意,无论如何,您需要检查您的 sql server 配置,30k 条记录不足以超过默认超时。B/w 如果您只是更改 Web 服务器中的超时,它不会影响您的 b/c 浏览器具有默认超时。可能mysqltuner可以帮助您查找配置错误。

回答by feddy

nano /usr/share/phpMyAdmin/libraries/config.default.php

Add / edit:

添加/编辑:

$cfg['ExecTimeLimit'] = 1800000;

I hope you're gonna get rid of it.

我希望你能摆脱它。

回答by Ilya Yaremchuk

504 Gateway Timeout error it appears in those cases when a server that hosts the website is unable to return to the set time limit HTTP-response.

504 网关超时错误它出现在托管网站的服务器无法返回到设置的时间限制 HTTP 响应的情况下。

As a solution to suit the increase in PHP max_execution_time parameter value

作为适应PHP max_execution_time 参数值增加的解决方案

回答by SevenOfNine

504 Gatetimeoutis a HTTP Error not a database error. The database takes too long to collect your data. You probably have to increase max_execution_timein your php.ini

504 Gatetimeout是 HTTP 错误而不是数据库错误。数据库需要很长时间来收集您的数据。你可能需要max_execution_time在你的 php.ini 中增加