mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 07:43:10 -05:00
issue: Updating large chats is slow #4924
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?
Originally created by @crizCraig on GitHub (Apr 21, 2025).
Check Existing Issues
Installation Method
Git Clone
Open WebUI Version
0.5.20
Ollama Version (if applicable)
No response
Operating System
macOS Sonoma
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Chat updates should be partial consisting of just the edited messages, especially for large chats. This will keep the database and CPU resources free to serve other requests and maintain app snapiness.
We could use
jsonb_setwhich would lead to much less network i/o and scan time. Here's a link to my most frequent slow queries, of which the top four are all chat updates / inserts that could be optimized with jsonb operations.Since postgres always writes an entirely new row for updates, it may be best to normalize chats into multiple
chat_messages. This will save disk i/o as well as network i/o and reduce vacuum pressure from huge inserts. It may also be worth considering using theSTORAGE_PROVIDERfor super large chats (treating them as files like claude does).Actual Behavior
We currently update the entire JSON
chat.chatobject for every message (I'm using PostGres)Steps to Reproduce
This query is useful for me to find slow operations
Logs & Screenshots
Sheet referenced earlier with slow queries
https://docs.google.com/spreadsheets/d/1KdZw7Chu6rki1oVbQ3Y-cFjGe2Q5GRNA5I6_4TSXeO0/edit?gid=125432246#gid=125432246
Additional Information
No response