fix: resolve project search OR precedence bug and optimize count quer…#7277
Open
prabinoid wants to merge 2 commits into
Open
fix: resolve project search OR precedence bug and optimize count quer…#7277prabinoid wants to merge 2 commits into
prabinoid wants to merge 2 commits into
Conversation
…y with DB indexes
…ups, and fix org-filter count query regression
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What type of PR is this? (check all applicable)
Related Issue
Project search causing DB overload.
Describe this PR
Fixes a SQL operator precedence bug in the project search query where the
OR name ILIKEcondition was missing parentheses, causing it to scan projectnames across all locales instead of being scoped to the user's requested
locale. Under concurrent load, this turns into a full table scan
storm on
project_infothat affects performance.Speeds up the project list, especially when the map is shown. Before, the app
loaded the full details of every matching project just to display map dots
and one page of results. Now it loads only the lightweight bits needed for the
map, and asks the database for just the page of results being shown.
Removes repeated database calls when building each page. The list used to make
several small queries per project (around 50+ for a single page); these are
now combined into a handful of queries, cutting down round-trips.
Adds a migration with a composite index on
projects(status, private)—present in every search query's WHERE clause but previously unindexed — and a
single index on
projects(priority)for the defaultORDER BYon every pageload.