Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Optimize of SQL requests

Hi, everyone. I looked at log of Tarantula and found part that are requested to DB.

I think you may optimize some requests. Results will fewer queries to DB.

Look at log below. You have set of test cases id and then you do SELECT request to DB by single ID of test case. If you will use SELECT ....... WHERE test_cases.id in you need only one request and result will be same.

Think about it. Ready to discuss

--------------------------------------------------------
Started PUT "/requirements/24" for 127.0.0.1 at 2012-12-06 13:32:42 +0400
User Load (0.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 8 LIMIT 1
Processing by RequirementsController#update as JS
Parameters: {"data"=>"{\"name\":\"10.2 SERIES RECORDING RULES\",\"date\":\"2012-10-09T00:00:00\",\"external_id\":\"141\",\"priority\":\"\",\"updated_at\":\"2012-10-09T16:08:50+03:00\",\"tag_list\":\"10.2,Series Recording Rules\",\"test_area_ids\":[],\"description\":\"•\\tQuick Record will display Record, Cancel and More Options \\n•\\tMore Options will display Playback, Keep, Start, Stop fields. \\n•\\tNote: More Options screen will default to One time Recording will not provide an option to record the program as a series\",\"cases\":[628,6704,629,630,631,632,633,643,654,661,649,651,645,6700,579,585,587,583,584,605,652,646,648,650,1309,8562,8563,8564,8554,8561,1310,1313,1305,1314]}", "_"=>"", "id"=>"24"}
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 8 LIMIT 1
ProjectAssignment Load (0.1ms) SELECT `project_assignments`.* FROM `project_assignments` WHERE `project_assignments`.`user_id` = 8 AND `project_assignments`.`project_id` = 10 LIMIT 1
Project Load (0.1ms) SELECT `projects`.* FROM `projects` WHERE `projects`.`id` = 10 LIMIT 1
CACHE (0.0ms) SELECT `project_assignments`.* FROM `project_assignments` WHERE `project_assignments`.`user_id` = 8 AND `project_assignments`.`project_id` = 10 LIMIT 1
Requirement Load (0.1ms) SELECT `requirements`.* FROM `requirements` WHERE `requirements`.`id` = 24 LIMIT 1
CACHE (0.0ms) SELECT `project_assignments`.* FROM `project_assignments` WHERE `project_assignments`.`user_id` = 8 AND `project_assignments`.`project_id` = 10 LIMIT 1
CACHE (0.0ms) SELECT `project_assignments`.* FROM `project_assignments` WHERE `project_assignments`.`user_id` = 8 AND `project_assignments`.`project_id` = 10 LIMIT 1
Case Load (0.1ms) SELECT `cases`.* FROM `cases` WHERE `cases`.`id` = 628 LIMIT 1
Case Load (0.1ms) SELECT `cases`.* FROM `cases` WHERE `cases`.`id` = 6704 LIMIT 1
Case Load (0.1ms) SELECT `cases`.* FROM `cases` WHERE `cases`.`id` = 629 LIMIT 1
Case Load (0.1ms) SELECT `cases`.* FROM `cases` WHERE `cases`.`id` = 630 LIMIT 1
Case Load (0.1ms) SELECT `cases`.* FROM `cases` WHERE `cases`.`id` = 631 LIMIT 1
Case Load (0.1ms) SELECT `cases`.* FROM `cases` WHERE `cases`.`id` = 632 LIMIT 1
1 person likes
this idea
+1
Reply