Files
open-webui/backend/open_webui
Classic298 b21b90533e fix: chat search with View set to All takes minutes when many chats are shared (#34911)
Searching chats in the search dialog with View set to All went through every shared chat on the instance before checking whether the searcher may open it. On PostgreSQL it also read through the messages of all users' chats, only to drop the ones the searcher cannot open, so one search could run for minutes while holding database connections. Now the folders and shared chats the searcher can open are looked up first and only those are searched, which also speeds up Created by you. The results are the same as before, and a user who owns nearly every chat keeps today's speed.

Measured on PostgreSQL with 61,000 chats (640,000 messages) and 1,000 shared chats (410 MB), for one user who can open 1,400 chats and 300 shared chats and one who can open 7,500 chats and 400 shared chats.

<table>
<tr><th>search</th><th>1,400 chats before</th><th>after</th><th>7,500 chats before</th><th>after</th></tr>
<tr><td>All, empty</td><td>1.2 s</td><td>0.2 s</td><td>2.3 s</td><td>0.3 s</td></tr>
<tr><td>All, a common word</td><td>10.8 s</td><td>1.0 s</td><td>12.5 s</td><td>7.6 s</td></tr>
<tr><td>All, two words</td><td>18.2 s</td><td>1.4 s</td><td>20.8 s</td><td>14.3 s</td></tr>
<tr><td>All, a rare word</td><td>14.5 s</td><td>2.4 s</td><td>15 s</td><td>8.9 s</td></tr>
<tr><td>Created by you, a common word</td><td>0.04 s</td><td>0.04 s</td><td>7.0 s</td><td>0.15 s</td></tr>
<tr><td>Created by you, 14 words</td><td>1.6 s</td><td>0.19 s</td><td>3.9 s</td><td>1.8 s</td></tr>
</table>

Fixes #34903
2026-11-23 21:56:08 +04:00
..
2026-11-17 23:28:54 +09:00
2026-11-23 16:10:09 +04:00
2026-11-23 16:21:00 +04:00
2026-11-23 16:21:00 +04:00
2026-11-02 09:59:00 +09:00
2026-10-05 12:03:19 +04:00
2026-11-23 02:26:51 +04:00
2026-11-22 20:47:46 +04:00
2026-11-23 16:21:00 +04:00
2026-11-03 16:25:23 +09:00
2026-11-02 08:48:51 +09:00