我现在面临严重的问题,在我的锻炼,而正在运行相同的代码与本地主机相同的数据库时,它的正常工作与PHP和MySQL Linux服务器上。MySQL的超时问题
除了我在数据库中的表和MySQL差不多30000条记录是:
SELECT * FROM tbl_movies where id not in (select movie_id from tbl_usermovieque where user_id='3' union
select movie_id from tbl_user_movie_response where user_id='3' union
select movie_id from tbl_user_movie_fav where user_id='3') and id < 220 order by rand() limit 0,20
其采取在我的本地0.0010秒和无限我们的Linux服务器上。我无法找到原因。
感谢 卡迈勒
你有你的表有正确的'indexes'? –
你用php标记了这个问题,但只给我们一个SQL语句 - 你是否尝试过SQL命令行上的语句或像phpmyadmin这样的数据库工具?也许它不是SQL语句是缓慢的,但有你的PHP脚本,并链接编辑通过优化订购 – cypherabe