mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 02:48:13 -05:00
[PR #24247] perf: Add SQLite index for default chat sidebar pagination #50561
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/24247
Author: @PhilosophiMoonbeam
Created: 4/29/2026
Status: 🔄 Open
Base:
dev← Head:optimize-sqlite-chat-sidebar-index📝 Commits (10+)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devd95f533Merge pull request #19729 from open-webui/deva7271530.6.43 (#20093)6adde20Merge pull request #20394 from open-webui/devf9b0534Merge pull request #20522 from open-webui/dev📊 Changes
2 files changed (+39 additions, -0 deletions)
View changed files
➕
backend/open_webui/migrations/versions/6f0d1234abcd_add_chat_sidebar_default_index.py(+30 -0)📝
backend/open_webui/models/chats.py(+9 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
Discussion created after the PR was opened: https://github.com/open-webui/open-webui/discussions/24248
Before submitting, make sure you've checked the following:
devbranch. PRs targetingmainwill be immediately closed.devto ensure no unrelated commits (e.g. frommain) are included. Push updates to the existing PR branch instead of closing and reopening.Changelog Entry
Description
ORDER BY updated_at DESC, idwithout building a temporary sort for the common non-folder, non-archived, non-pinned chat list.Added
chat_sidebar_default_idxon(user_id, updated_at DESC, id)with a SQLite partial predicate matching the default chat sidebar query.Changed
Chat.__table_args__metadata to include the new SQLite index.Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
USE TEMP B-TREE FOR ORDER BYfor the default sidebar query.chat_sidebar_default_idxdirectly for the default query.Validation performed:
EXPLAIN QUERY PLANuseschat_sidebar_default_idxfor the default sidebar query without a temp sort.Related Discussion: https://github.com/open-webui/open-webui/discussions/24248
Screenshots or Videos
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.