Mysql phpMyadmin 超时问题

发布于 2024-10-28 08:14:47 字数 473 浏览 3 评论 0原文

我在Mysql中有一个非常大的数据库。我需要以这种方式维护它。例如,Innodb 中大约有 300,000 条记录。

我将记录解析到数据库中,但现在我需要通过转换一些字段类型(例如将 long int 转换为tinyint 或其他类型)来完善它。当我通过 phpMyadmin 运行此命令时,6 分钟后连接停止,并且出现连接超时错误?

既然php将请求发送到mysql,那么mysql不应该只是做它的事情直到它完成吗?所以即使 php 页面超时它仍然会完成吗?或者当连接超时时Mysql就放弃请求?

我需要通过 php 在数据库上运行过滤器,并且我希望能够每 30 秒更新一次页面,并在继续搜索时使用它找到的新结果,但如果用户导航离开,我仍然希望完成搜索它为该用户创建一个表。因此,如果他们运行查询并在返回时关闭浏览器,搜索还会继续吗?

以前从未使用过这样的大数据库,如果用户运行文本搜索,我知道这将需要很长时间。任何见解/提示或指导将不胜感激。

谢谢

I have a very large database in Mysql. I need it to be maintained this way. for example its about 300,000 records in Innodb.

I parsed the records into the database but now I need to refine it by converting some of the field types for example a long int to tinyint or something. When I run this through phpMyadmin the connection after 6mins halts and I get a connection timeout error?.

Since php sent the request to mysql shouldn't mysql just be doing its thing no matter what until its done? so even if the php page times out it will it still get done?. Or when the connection times out does Mysql just give up on the request?.

I need to run a filter on the database through php and I want to be able to update the page every 30 seconds with new results it finds as its continuing its search , but if the user navigates away I would still like to finish the search as it creates a table for that user. So if they run a query and close their browser when they come back to it will it have continued with the search ?.

Never worked with a big db like this before , if users run a textual search I know it will take a long time. Any insights /tips or guidance would be appreciated .

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墟烟 2024-11-04 08:14:47

通常,您也可以在服务器本身上使用 mysql 客户端。对于导入的大型数据库来说,它往往是我的最爱。

mysql -u user -p -h localhost dbname < import.sql

或者在您的情况下进入命令提示符(与 phpmyadmin 中的 SQL 窗口相同):

mysql -u user -p -h localhost dbname

You can also generally use the mysql client on the server itself. It tends to be my favorite for imported large DBs.

mysql -u user -p -h localhost dbname < import.sql

Or in your case to get to the command prompt (same as the SQL window in phpmyadmin:

mysql -u user -p -h localhost dbname
无语# 2024-11-04 08:14:47

在 InnoDB 中,所有用户活动都发生在事务内。 因此,如果查询没有进入最后,事务将不会被提交并被保留。

然而,在 PHP 中,即使用户停止网页,您也可以告诉脚本继续运行。这是通过函数 ignore_user_abort() 完成的。

但我认为 phpMyAdmin 没有提供ignore_user_abort 功能。

另一个解决方案是使用异步 MySQL 查询,但我认为 PHP 还不可能。 也许在这里,但也不在 phpMyAdmin 中。

In InnoDB, all user activity occurs inside a transaction. So, if the query is not going into the end, the transaction won't be committed and it will be leaved.

Nevertheless, in PHP, you can tell a script to continue even if the user is stopping the web page. It is done with the function ignore_user_abort().

but I think phpMyAdmin doesn't give a ignore_user_abort feature.

Another solution would be to use asynchronous MySQL query but I think it is not (yet) possible with PHP. Maybe here, but not in phpMyAdmin neither.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文