[GH-ISSUE #10807] Performance degradation with external databases #16038

Closed
opened 2026-04-19 22:05:04 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @TobiasGoerke on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10807

Description

When using external PostgreSQL instances (Azure Flexible Server/Google Cloud SQL), Open WebUI becomes severely sluggish – simple actions like opening a chat take 10-15 seconds.

The core issue stems from:

  • Query amplification: 3+ auth queries (get_user_by_id, update_user_last_active_by_id) + 2+ endpoint-specific queries per request
  • Latency multiplier: 150-250ms average database response time
  • Cumulative effect: A window reload triggers ~20 API calls → 60-100 database queries. This is about 15 seconds for me.
  • Note: Pooling has helped me to cut the response times in half. Still, the issue persists.

Example Breakdown

For get_chat_tags_by_id:

  • Authentication: 3 queries (200ms × 3 = 600ms)
  • Endpoint logic: 2+ queries (200ms × 2 = 400ms)
  • Total: ~1 second baseline before business logic

Key Questions

  1. Are others running Open WebUI successfully with managed databases at this latency tier?
  2. Can we:
  • Reduce auth query count (3→1?)
  • Reduce redundant user activity updates or at least update asynchronously
  • Parallelize queries in endpoint chains
  1. What caching strategies work for session data without sacrificing security?

Query Log

Here's all queries launched for one page reload (61 queries):
queries.log

Thanks!

Originally created by @TobiasGoerke on GitHub (Feb 26, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/10807 ## Description When using external PostgreSQL instances (Azure Flexible Server/Google Cloud SQL), Open WebUI becomes severely sluggish – simple actions like opening a chat take 10-15 seconds. The core issue stems from: * Query amplification: 3+ auth queries (`get_user_by_id`, `update_user_last_active_by_id`) + 2+ endpoint-specific queries per request * Latency multiplier: 150-250ms average database response time * Cumulative effect: A window reload triggers ~20 API calls → 60-100 database queries. This is about 15 seconds for me. * Note: Pooling has helped me to cut the response times in half. Still, the issue persists. ## Example Breakdown For `get_chat_tags_by_id`: * Authentication: 3 queries (200ms × 3 = 600ms) * Endpoint logic: 2+ queries (200ms × 2 = 400ms) * Total: ~1 second baseline before business logic ## Key Questions 1. Are others running Open WebUI successfully with managed databases at this latency tier? 2. Can we: * Reduce auth query count (3→1?) * Reduce redundant user activity updates or at least update asynchronously * Parallelize queries in endpoint chains 3. What caching strategies work for session data without sacrificing security? ## Query Log Here's all queries launched for one page reload (61 queries): [queries.log](https://github.com/user-attachments/files/18981257/queries.log) Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#16038