如何增加mysql查询执行时间

时间:2015-12-10 05:50:11

标签: php mysql codeigniter

我正在使用带有codeigniter框架的mysql数据库 在那个连接中,一次超过5个表。 MySql查询很好,它可以正确生成结果,但是生成大约9-12 sec的结果需要花费太多时间。 如何增加查询的执行时间。

SELECT `questions`.* FROM `questions` LEFT JOIN `universities_questions` ON `questions`.`id` = `universities_questions`.`question_id` LEFT JOIN `courses_questions` ON `questions`.`id` = `courses_questions`.`question_id` LEFT JOIN `branches_questions` ON `questions`.`id` = `branches_questions`.`question_id` LEFT JOIN `subjects_questions` ON `questions`.`id` = `subjects_questions`.`question_id` LEFT JOIN `question_types_questions` ON `questions`.`id` = `question_types_questions`.`question_id` LEFT JOIN `questions_year` ON `questions`.`id` = `questions_year`.`question_id` WHERE `questions`.`status` = '1' GROUP BY `questions`.`id` ORDER BY `questions`.`id` DESC LIMIT 1

1 个答案:

答案 0 :(得分:0)

如果你不想搞乱你的SQL,你可以使用php睡眠功能......

sleep(10);

以上行将延迟执行此行的任何代码10秒钟。 Here is the php documentation