Mysql phpMyadmin 超时问题
我在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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,您也可以在服务器本身上使用 mysql 客户端。对于导入的大型数据库来说,它往往是我的最爱。
或者在您的情况下进入命令提示符(与 phpmyadmin 中的 SQL 窗口相同):
You can also generally use the mysql client on the server itself. It tends to be my favorite for imported large DBs.
Or in your case to get to the command prompt (same as the SQL window in phpmyadmin:
在 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.