mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 19:08:59 -05:00
[PR #21590] [MERGED] perf: Query title column directly in get_chat_title_by_id instead of loading full chat #65008
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/21590
Author: @Classic298
Created: 2/19/2026
Status: ✅ Merged
Merged: 2/19/2026
Merged by: @tjbck
Base:
dev← Head:perf-chat-title-query📝 Commits (1)
d69fb74Query title column directly in get_chat_title_by_id instead of loading full chat (#157)📊 Changes
1 file changed (+5 additions, -5 deletions)
View changed files
📝
backend/open_webui/models/chats.py(+5 -5)📄 Description
Previously loaded the entire ChatModel (including the full conversation JSON blob) just to extract the title string. Now queries only the Chat.title column directly, which is already a top-level DB column.
get_chat_title_by_id: 2 call sites, both in middleware.py (lines 2927 and 4432). It's called to grab the title for notification/logging purposes after a response completes. Low frequency, but saves transmitting the full blob over the wire for something that's just a column read.
Makes the database query MUCH faster as only the title has to be grabbed and also saves network latency and network bandwidth!
For a chat with hundreds of messages, the difference between
SELECT title FROM chat WHERE id = ?andSELECT * FROM chat WHERE id = ?is significant at every layer: disk I/O, DB CPU, network, and application memory.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.