Skip to content

Commit

Permalink
sim: submissions API: fix sluggish SQL query execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
varqox committed Nov 3, 2024
1 parent fc9a33b commit 29b89ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions subprojects/sim/src/web_server/submissions/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Response do_list(Context& ctx, uint32_t limit, Condition<Params...>&& where_cond
.from("submissions s")
.left_join("users u")
.on("u.id=s.user_id")
.inner_join("problems p")
.left_join("problems p") // left_join is faster than inner_join
.on("p.id=s.problem_id")
.left_join("contest_problems cp")
.on("cp.id=s.contest_problem_id")
Expand Down Expand Up @@ -338,7 +338,7 @@ optional<ContestProblemInfoForGettingCapabilities> get_contest_problem_info_for_
auto stmt =
ctx.mysql.execute(Select("cr.full_results, cu.mode")
.from("contest_problems cp")
.inner_join("contest_rounds cr")
.left_join("contest_rounds cr") // left_join is faster than inner_join
.on("cr.id=cp.contest_round_id")
.left_join("contest_users cu")
.on("cu.user_id=? AND cu.contest_id=cp.contest_id",
Expand Down Expand Up @@ -2112,7 +2112,7 @@ Response view_submission(Context& ctx, decltype(Submission::id) submission_id) {
"cp.method_of_choosing_final_submission, "
"cp.score_revealing, cr.full_results, cu.mode")
.from("submissions s")
.inner_join("problems p")
.left_join("problems p") // left_join is faster than inner_join
.on("p.id=s.problem_id")
.left_join("contest_problems cp")
.on("cp.id=s.contest_problem_id")
Expand Down Expand Up @@ -2161,7 +2161,7 @@ Response view_submission(Context& ctx, decltype(Submission::id) submission_id) {
.from("submissions s")
.left_join("users u")
.on("u.id=s.user_id")
.inner_join("problems p")
.left_join("problems p") // left_join is faster than inner_join
.on("p.id=s.problem_id")
.left_join("contest_problems cp")
.on("cp.id=s.contest_problem_id")
Expand Down

0 comments on commit 29b89ff

Please sign in to comment.