mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 01:12:43 -05:00
With pgvector, removing, updating or re-syncing a file in a knowledge base scanned every chunk of that knowledge base to find the file's own chunks, and so did the check for a duplicate upload. A cleanup of 94 files through the knowledge base sync API, in a knowledge base of 756,000 chunks, took about a minute, long enough for sync clients to time out. These lookups now use indexes instead of scanning the whole knowledge base. The indexes are built once on the first start after upgrading, which took under 3 seconds on a table of 1.5 million chunks. They are skipped when PGVECTOR_PGCRYPTO is enabled, because encrypted metadata cannot be indexed, so those setups keep the old speed. <table> <tr><th>756,000 chunks in the knowledge base</th><th>Before</th><th>After</th></tr> <tr><td>Sync cleanup, 94 files</td><td>60.8 s</td><td>0.96 s</td></tr> <tr><td>Remove one file</td><td>631 ms</td><td>22 ms</td></tr> <tr><td>Update one file</td><td>973 ms</td><td>488 ms</td></tr> <tr><td>Reject a duplicate upload</td><td>204 ms</td><td>70 ms</td></tr> </table> Fixes #35122