此代码无限期加载:
$answer_articles = $bdd->prepare(
"SELECT *
FROM todo
LEFT JOIN links_task_text
ON links_task_text.links_task_text_id_task = todo.ID
WHERE todo.site = ?");
$answer_articles->execute(array('xxx'));
exit();
此代码当然有效:
$answer_articles = $bdd->prepare(
"SELECT *
FROM todo
WHERE site = ?");
$answer_articles->execute(array('xxx'));
exit();
//working and no loading delays
此代码也正常运行:
$answer_articles = $bdd->prepare(
"SELECT * FROM todo
INNER JOIN links_task_text
ON links_task_text.links_task_text_id_task = todo.ID
WHERE todo.site = ?");
$answer_articles->execute(array('xxx'));
exit();
//works but it's not what I need
links_task_text.links_task_text_id_task
和todo.ID
是INT。
我不明白为什么左连接不起作用。一些想法?
答案 0 :(得分:1)
列links_task_text_id_task是否有索引?
如果不是,则查询在links_task_text上运行全表扫描需要很长时间。