I have searched the existing issues and discussions.
Problem Description
Hi! I'm experiencing a high latency in the application when there are many models (more than 30) enabled. There are many queries being executed just to load the models. Here an example of a trace in Datadog (more than 500 spans):
I would consider a fast query to get the models when loading the application and specific queries to get specific models when the user is going to use them.
Also consider cache models would be beneficial.
Alternatives Considered
No response
Additional Context
No response
Originally created by @mknet3 on GitHub (Jun 18, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15111
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
### Problem Description
Hi! I'm experiencing a high latency in the application when there are many models (more than 30) enabled. There are many queries being executed just to load the models. Here an example of a trace in Datadog (more than 500 spans):

There are a lot of queries to get functions
```sql
SELECT function.id, function.user_id, function.name, function.type, function.content, function.meta, function.valves, function.is_active, function.is_global, function.updated_at, function.created_at
FROM function
WHERE function.type = ? AND function.is_active = ? AND function.is_global = ?
```

### Desired Solution you'd like
I would consider a fast query to get the models when loading the application and specific queries to get specific models when the user is going to use them.
Also consider cache models would be beneficial.
### Alternatives Considered
_No response_
### Additional Context
_No response_
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @mknet3 on GitHub (Jun 18, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/15111
Check Existing Issues
Problem Description
Hi! I'm experiencing a high latency in the application when there are many models (more than 30) enabled. There are many queries being executed just to load the models. Here an example of a trace in Datadog (more than 500 spans):
There are a lot of queries to get functions
Desired Solution you'd like
I would consider a fast query to get the models when loading the application and specific queries to get specific models when the user is going to use them.
Also consider cache models would be beneficial.
Alternatives Considered
No response
Additional Context
No response
@tjbck commented on GitHub (Jun 18, 2025):
PR welcome!