{"action":"created","issue":{"url":"https://api.github.com/repos/ponkotuy/MyFleetGirls/issues/288","labels_url":"https://api.github.com/repos/ponkotuy/MyFleetGirls/issues/288/labels{/name}","comments_url":"https://api.github.com/repos/ponkotuy/MyFleetGirls/issues/288/comments","events_url":"https://api.github.com/repos/ponkotuy/MyFleetGirls/issues/288/events","html_url":"https://github.com/ponkotuy/MyFleetGirls/issues/288","id":108453694,"number":288,"title":"遅いクエリ改善","user":{"login":"ponkotuy","id":4147492,"avatar_url":"https://avatars.githubusercontent.com/u/4147492?v=3","gravatar_id":"","url":"https://api.github.com/users/ponkotuy","html_url":"https://github.com/ponkotuy","followers_url":"https://api.github.com/users/ponkotuy/followers","following_url":"https://api.github.com/users/ponkotuy/following{/other_user}","gists_url":"https://api.github.com/users/ponkotuy/gists{/gist_id}","starred_url":"https://api.github.com/users/ponkotuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ponkotuy/subscriptions","organizations_url":"https://api.github.com/users/ponkotuy/orgs","repos_url":"https://api.github.com/users/ponkotuy/repos","events_url":"https://api.github.com/users/ponkotuy/events{/privacy}","received_events_url":"https://api.github.com/users/ponkotuy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":46,"created_at":"2015-09-26T10:13:02Z","updated_at":"2015-10-20T18:17:36Z","closed_at":null,"body":"https://github.com/ponkotuy/MyFleetGirls/blob/26d741efb21c2879856c33b8cf797995718627fb/server/app/models/db/ShipHistory.scala#L73 が吐く\r\n```sql\r\nselect sh.id as i_on_sh, sh.ship_id as si_on_sh, sh.member_id as mi_on_sh, sh.lv as l_on_sh, sh.exp as e_on_sh, sh.created as c_on_sh from ship_history sh where sh.created = ( \r\nselect max(sha.created) from ship_history sha where sh.member_id = sha.member_id and sh.ship_id = sha.ship_id and sh.member_id = 14054676 and sh.ship_id in (1, 2, 4, 6, 7, 18, 19, 21, 24, 25, 27, 28, 32, 35, 39, 40, 45, 47, 55, 62, 71, 72, 78, 80, 81, 84, 92, 96, 100, 105, 106, 107, 111, 118, 120, 122, 128, 139, 162, 167, 168, 169, 177, 183, 209, 217, 218, 222, 235, 241, 243, 267, 278, 281, 288, 296, 325, 339, 370, 397, 405, 426, 477, 532, 555, 587, 667, 739, 753, 855, 887, 894, 896, 1021, 1066, 1067, 1479, 1644, 1782, 1899, 1921, 1996, 2128, 2187, 2447, 2448, 2452, 2477, 2487, 2495, 2502, 2615, 2775, 2985, 3360, 3577, 3591, 3710, 3740, 3741, 3749, 3753, 3760, 3773, 3803, 3846, 3889, 3996, 4084, 4085, 4087, 4564, 4566, 4675, 4728, 4868, 4875, 4884, 4912, 4958, 4978, 5033, 5245, 5509, 6048, 6049, 6085, 6110, 6115, 6220, 6235, 6288, 6293, 6308, 6375, 6518, 6529, 6563, 6957, 7048, 7105, 7145, 7186, 7260, 7309, 7444, 7457, 7463, 7805, 7897, 7917, 7967, 8036, 8069, 8095, 8311, 8316, 8317, 8356, 8786, 8839, 8840, 8846, 8855, 8856, 8860, 8861, 8863, 8865, 8867, 8868) \r\n) and sh.member_id = 14054676 and sh.ship_id in (1, 2, 4, 6, 7, 18, 19, 21, 24, 25, 27, 28, 32, 35, 39, 40, 45, 47, 55, 62, 71, 72, 78, 80, 81, 84, 92, 96, 100, 105, 106, 107, 111, 118, 120, 122, 128, 139, 162, 167, 168, 169, 177, 183, 209, 217, 218, 222, 235, 241, 243, 267, 278, 281, 288, 296, 325, 339, 370, 397, 405, 426, 477, 532, 555, 587, 667, 739, 753, 855, 887, 894, 896, 1021, 1066, 1067, 1479, 1644, 1782, 1899, 1921, 1996, 2128, 2187, 2447, 2448, 2452, 2477, 2487, 2495, 2502, 2615, 2775, 2985, 3360, 3577, 3591, 3710, 3740, 3741, 3749, 3753, 3760, 3773, 3803, 3846, 3889, 3996, 4084, 4085, 4087, 4564, 4566, 4675, 4728, 4868, 4875, 4884, 4912, 4958, 4978, 5033, 5245, 5509, 6048, 6049, 6085, 6110, 6115, 6220, 6235, 6288, 6293, 6308, 6375, 6518, 6529, 6563, 6957, 7048, 7105, 7145, 7186, 7260, 7309, 7444, 7457, 7463, 7805, 7897, 7917, 7967, 8036, 8069, 8095, 8311, 8316, 8317, 8356, 8786, 8839, 8840, 8846, 8855, 8856, 8860, 8861, 8863, 8865, 8867, 8868);\r\n```\r\n\r\nが遅いのでなんとかするか諦める"},"comment":{"url":"https://api.github.com/repos/ponkotuy/MyFleetGirls/issues/comments/149652855","html_url":"https://github.com/ponkotuy/MyFleetGirls/issues/288#issuecomment-149652855","issue_url":"https://api.github.com/repos/ponkotuy/MyFleetGirls/issues/288","id":149652855,"user":{"login":"ponkotuy","id":4147492,"avatar_url":"https://avatars.githubusercontent.com/u/4147492?v=3","gravatar_id":"","url":"https://api.github.com/users/ponkotuy","html_url":"https://github.com/ponkotuy","followers_url":"https://api.github.com/users/ponkotuy/followers","following_url":"https://api.github.com/users/ponkotuy/following{/other_user}","gists_url":"https://api.github.com/users/ponkotuy/gists{/gist_id}","starred_url":"https://api.github.com/users/ponkotuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ponkotuy/subscriptions","organizations_url":"https://api.github.com/users/ponkotuy/orgs","repos_url":"https://api.github.com/users/ponkotuy/repos","events_url":"https://api.github.com/users/ponkotuy/events{/privacy}","received_events_url":"https://api.github.com/users/ponkotuy/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T18:17:35Z","updated_at":"2015-10-20T18:17:35Z","body":"> GROUP BYのカラム順とINDEXのカラム順を合わせると、using temporaryではなくなるようです。\r\n\r\nは多分違うくて、groupbyがindex内で完結するからだと思う。実際既に(member_id, ship_id, created)のindexあるけど効果はなかった。"}}