Actions
Patch #40775
closedReduce an extra SQL query in IssuesController#retrieve_default_query
Description
The IssuesController#retrieve_default_query
method to retrieve the default issue query checks if a query is explicitly specified in the session and the existence of the query.
Although the check for the existence is only necessary when session[:issue_query][:id]
is set, the current code performs a query against the queries
table even when session[:issue_query][:id]
is nil. This causes an unnecessary query that checks if a row with id=NULL exists.
IssueQuery Exists? (0.1ms) SELECT 1 AS one FROM "queries" WHERE "queries"."type" = ? AND "queries"."id" IS NULL LIMIT ? [["type", "IssueQuery"], ["LIMIT", 1]]
The attached patch changes to skip the unnecessary query when session[:issue_query][:id]
is nil.
Files
Actions