[GH-ISSUE #21252] feat: convert N groups querys to one query #34951

Closed
opened 2026-04-25 09:07:39 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @benjamin20000 on GitHub (Feb 8, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21252

Check Existing Issues

  • I have searched for all existing open AND closed issues and discussions for similar requests. I have found none that is comparable to my request.

Verify Feature Scope

  • I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions.

Problem Description

The admin panel and settings are getting very slow after adding groups,
I did a review in backend/models/groups.py and, and saw the following code in the get_groups function:
return [
GroupResponse.model_validate(
{
**GroupModel.model_validate(group).model_dump(),
"member_count": self.get_group_member_count_by_id(
group.id, db=db
),
}
)
for group in groups
]

It looks like this triggers a new database query(and connection) for each group in order to count members, which is very inefficient.

Desired Solution you'd like

get the groups member counts with one query

Alternatives Considered

No response

Additional Context

No response

Originally created by @benjamin20000 on GitHub (Feb 8, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21252 ### Check Existing Issues - [x] I have searched for all existing **open AND closed** issues and discussions for similar requests. I have found none that is comparable to my request. ### Verify Feature Scope - [x] I have read through and understood the scope definition for feature requests in the Issues section. I believe my feature request meets the definition and belongs in the Issues section instead of the Discussions. ### Problem Description The admin panel and settings are getting very slow after adding groups, I did a review in backend/models/groups.py and, and saw the following code in the get_groups function: return [ GroupResponse.model_validate( { **GroupModel.model_validate(group).model_dump(), "member_count": self.get_group_member_count_by_id( group.id, db=db ), } ) for group in groups ] It looks like this triggers a new database query(and connection) for each group in order to count members, which is very inefficient. ### Desired Solution you'd like get the groups member counts with one query ### Alternatives Considered _No response_ ### Additional Context _No response_
Author
Owner

@pr-validator-bot commented on GitHub (Feb 8, 2026):

⚠️ Invalid Issue Title

Hey @benjamin20000, please provide a descriptive title for your issue. Titles that are empty, very short (under 10 characters), or generic (like "issue:" or "feat:") make it difficult for volunteer contributors to understand and triage issues.

Please update the title to reflect the content of your issue.


⚠️ Missing Issue Title Prefix

@benjamin20000, your issue title is missing a prefix (e.g., bug:, feat:, docs:).

Please update your issue title to include one of the following prefixes:

  • bug: Bug report or error you've encountered
  • feat: Feature request or enhancement suggestion
  • docs: Documentation issue or improvement request
  • question: Question about usage or functionality
  • help: Request for help or support

Example: bug: Login fails when using special characters in password

<!-- gh-comment-id:3867084894 --> @pr-validator-bot commented on GitHub (Feb 8, 2026): # ⚠️ Invalid Issue Title Hey @benjamin20000, please provide a descriptive title for your issue. Titles that are empty, very short (under 10 characters), or generic (like "issue:" or "feat:") make it difficult for volunteer contributors to understand and triage issues. Please update the title to reflect the content of your issue. --- # ⚠️ Missing Issue Title Prefix @benjamin20000, your issue title is missing a prefix (e.g., `bug:`, `feat:`, `docs:`). Please update your issue title to include one of the following prefixes: - **bug**: Bug report or error you've encountered - **feat**: Feature request or enhancement suggestion - **docs**: Documentation issue or improvement request - **question**: Question about usage or functionality - **help**: Request for help or support Example: `bug: Login fails when using special characters in password`
Author
Owner

@Classic298 commented on GitHub (Feb 8, 2026):

Check the open PRs

<!-- gh-comment-id:3867111357 --> @Classic298 commented on GitHub (Feb 8, 2026): Check the open PRs
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#34951