mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 17:02:01 -05:00
[PR #21017] [CLOSED] perf: eliminate N+1 tag operations in chats.py #129546
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21017
Author: @Classic298
Created: 1/28/2026
Status: ❌ Closed
Base:
dev← Head:chat-tags-n+1📝 Commits (1)
22532bcperf: eliminate N+1 tag operations in chats.py📊 Changes
2 files changed (+96 additions, -25 deletions)
View changed files
📝
backend/open_webui/models/chats.py(+76 -2)📝
backend/open_webui/routers/chats.py(+20 -23)📄 Description
Summary
Batch-optimized tag operations when deleting, archiving, and managing chat tags.
Changes
models/chats.py
routers/chats.py
Performance Impact
Before: 2N queries per operation (1 count + 1 delete per tag)
After: N count queries + batch deletes (still iterates for counts due to JSON complexity, but consolidated tag deletes)
For a chat with 5 tags being deleted:
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.