open-webui/backend/open_webui/routers
Classic298 b8fb9e815b
fix(channels): eliminate N+1 query in get_channel_messages endpoint (#20458)
Replaced per-message user lookup with batch fetch using SQL IN clause.

Changes:
- Fetch all message user_ids in a single pass
- Use Users.get_users_by_user_ids() for batch lookup
- Build user mapping to avoid DB calls in loop
- Add early return for empty message lists

Performance: Reduces N+1 queries to 2 queries (messages + users)
2026-01-07 23:36:12 +04:00
..
audio.py enh: WHISPER_COMPUTE_TYPE env var 2025-12-29 00:41:47 +04:00
auths.py refac 2026-01-01 14:10:11 +04:00
channels.py fix(channels): eliminate N+1 query in get_channel_messages endpoint (#20458) 2026-01-07 23:36:12 +04:00
chats.py refac 2025-12-31 20:23:32 +04:00
configs.py chore/perf: Remove old SRC level log env vars with no impact (#20045) 2025-12-20 08:16:14 -05:00
evaluations.py refac/enh: db session sharing 2025-12-29 00:21:18 +04:00
files.py refac/enh: db session sharing 2025-12-29 00:21:18 +04:00
folders.py refac/enh: db session sharing 2025-12-29 00:21:18 +04:00
functions.py refac/enh: db session sharing 2025-12-29 00:21:18 +04:00
groups.py refac: group share to settings 2026-01-05 05:32:56 +04:00
images.py refac 2026-01-06 03:24:08 +04:00
knowledge.py feat: Add read-only access support for Knowledge Bases (#20371) 2026-01-05 04:45:48 +04:00
memories.py refac 2025-12-29 00:55:53 +04:00
models.py feat: Models Atomic PR of #20243 (#20369) 2026-01-05 23:37:41 +04:00
notes.py fix(notes): eliminate N+1 query in get_notes endpoint 2026-01-07 23:32:56 +04:00
ollama.py refac 2025-12-31 02:27:55 -05:00
openai.py refac 2025-12-29 02:05:55 +04:00
pipelines.py chore/perf: Remove old SRC level log env vars with no impact (#20045) 2025-12-20 08:16:14 -05:00
prompts.py feat: Prompts Atomic PR of #20243 (#20368) 2026-01-05 04:36:13 +04:00
retrieval.py refac 2026-01-05 18:55:44 +04:00
scim.py refac 2025-12-29 01:20:04 +04:00
tasks.py chore/perf: Remove old SRC level log env vars with no impact (#20045) 2025-12-20 08:16:14 -05:00
tools.py feat: Tools Atomic PR of #20243 (#20370) 2026-01-06 03:00:48 +04:00
users.py fix: resolve N+1 query pattern in users endpoint (#20427) 2026-01-06 21:26:14 +04:00
utils.py chore/perf: Remove old SRC level log env vars with no impact (#20045) 2025-12-20 08:16:14 -05:00