Actions
Patch #36503
closedReduce extra queries in IssueQuery.default
Start date:
Due date:
% Done:
0%
Estimated time:
Description
The attached patch reduces the total number of SQL queries during the execution of IssueQuery.default
.
No default queries in any levels:
before:
UserPreference Load (0.2ms) SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = ? LIMIT ? [["user_id", 1], ["LIMIT", 1]] ↳ app/models/user.rb:394:in `pref' IssueQuery Load (0.1ms) SELECT "queries".* FROM "queries" WHERE "queries"."type" = ? AND "queries"."id" IS NULL LIMIT ? [["type", "IssueQuery"], ["LIMIT", 1]] ↳ app/models/issue_query.rb:83:in `default' Setting Load (0.1ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = ? ORDER BY "settings"."id" DESC LIMIT ? [["name", "default_issue_query"], ["LIMIT", 1]] ↳ app/models/setting.rb:360:in `find_or_default' IssueQuery Load (0.1ms) SELECT "queries".* FROM "queries" WHERE "queries"."type" = ? AND "queries"."id" = ? LIMIT ? [["type", "IssueQuery"], ["id", nil], ["LIMIT", 1]] ↳ app/models/issue_query.rb:86:in `default'
after:
UserPreference Load (0.1ms) SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = ? LIMIT ? [["user_id", 1], ["LIMIT", 1]] ↳ app/models/user.rb:394:in `pref' Setting Load (0.1ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = ? ORDER BY "settings"."id" DESC LIMIT ? [["name", "default_issue_query"], ["LIMIT", 1]] ↳ app/models/setting.rb:360:in `find_or_default'
A project-level default query defined:
before:
UserPreference Load (0.2ms) SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = ? LIMIT ? [["user_id", 1], ["LIMIT", 1]] ↳ app/models/user.rb:394:in `pref' IssueQuery Load (0.2ms) SELECT "queries".* FROM "queries" WHERE "queries"."type" = ? AND "queries"."id" IS NULL LIMIT ? [["type", "IssueQuery"], ["LIMIT", 1]] ↳ app/models/issue_query.rb:83:in `default' IssueQuery Load (0.2ms) SELECT "queries".* FROM "queries" WHERE "queries"."type" = ? AND "queries"."id" = ? LIMIT ? [["type", "IssueQuery"], ["id", 4], ["LIMIT", 1]] ↳ app/models/issue_query.rb:85:in `default'
after:
UserPreference Load (0.2ms) SELECT "user_preferences".* FROM "user_preferences" WHERE "user_preferences"."user_id" = ? LIMIT ? [["user_id", 1], ["LIMIT", 1]] ↳ app/models/user.rb:394:in `pref' IssueQuery Load (0.2ms) SELECT "queries".* FROM "queries" WHERE "queries"."type" = ? AND "queries"."id" = ? LIMIT ? [["type", "IssueQuery"], ["id", 4], ["LIMIT", 1]] ↳ app/models/issue_query.rb:87:in `default'
Files
Related issues
Actions