mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[PR #21006] [MERGED] perf: resolve N+1 query in knowledge batch file add #41510
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/21006
Author: @Classic298
Created: 1/28/2026
Status: ✅ Merged
Merged: 2/9/2026
Merged by: @tjbck
Base:
dev← Head:knowledge-query📝 Commits (1)
190d472fix: resolve N+1 query in knowledge batch file add📊 Changes
1 file changed (+12 additions, -10 deletions)
View changed files
📝
backend/open_webui/routers/knowledge.py(+12 -10)📄 Description
Summary
Eliminates N+1 database query in the add_files_to_knowledge_batch endpoint. Previously, when batch-adding files to a knowledge base, each file was fetched individually.
Changes
routers/knowledge.py add_files_to_knowledge_batch endpoint:
Performance Impact
Before: N+1 queries (1 per file in batch)
After: 1 query total using SQL IN clause
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.