Fix for solve the slowness when retrieving feedbacks, due to a N+1 database query problem in the implementation of evaluations endpoint.
Modify to use a single optimized query that joins feedback and user data.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/17976
**Author:** [@rgaricano](https://github.com/rgaricano)
**Created:** 10/1/2025
**Status:** 🔄 Open
**Base:** `dev` ← **Head:** `dev-FIX_N1_in_feedbacks`
---
### 📝 Commits (7)
- [`9e0b9c3`](https://github.com/open-webui/open-webui/commit/9e0b9c3d66bb9967cd60a3155a1b3071b9ef6df9) FIX: N+1 database query in feedbacks
- [`9ec6e0b`](https://github.com/open-webui/open-webui/commit/9ec6e0b4af8f9cff12c921830d45e51904349caa) Update feedbacks.py - Code Format
- [`14d27d0`](https://github.com/open-webui/open-webui/commit/14d27d022cb64a67cd96634af129a4632b12af80) Update evaluations.py - Code Format
- [`1b8240b`](https://github.com/open-webui/open-webui/commit/1b8240b396143115c1da0bd4754e3db235533aed) Update evaluations.py - Code Format
- [`7e42f27`](https://github.com/open-webui/open-webui/commit/7e42f27b3ab4267fb87fa4ae5586b3fac1f24739) Added ids_only & count parameters in get_all_feedbacks router
- [`1ed7a0d`](https://github.com/open-webui/open-webui/commit/1ed7a0ddd9861fb9484cb2c7cccbabb40463be74) Fix Format Code Issue
- [`4ccb8c7`](https://github.com/open-webui/open-webui/commit/4ccb8c78f767d108fb56e8f79e1c8705b194389c) remove unwanted space added
### 📊 Changes
**2 files changed** (+60 additions, -7 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/models/feedbacks.py` (+22 -0)
📝 `backend/open_webui/routers/evaluations.py` (+38 -7)
</details>
### 📄 Description
### FIX: N+1 database query in feedbacks
Fix for solve the slowness when retrieving feedbacks, due to a N+1 database query problem in the implementation of evaluations endpoint.
Modify to use a single optimized query that joins feedback and user data.
____
### Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/17976
Author: @rgaricano
Created: 10/1/2025
Status: 🔄 Open
Base:
dev← Head:dev-FIX_N1_in_feedbacks📝 Commits (7)
9e0b9c3FIX: N+1 database query in feedbacks9ec6e0bUpdate feedbacks.py - Code Format14d27d0Update evaluations.py - Code Format1b8240bUpdate evaluations.py - Code Format7e42f27Added ids_only & count parameters in get_all_feedbacks router1ed7a0dFix Format Code Issue4ccb8c7remove unwanted space added📊 Changes
2 files changed (+60 additions, -7 deletions)
View changed files
📝
backend/open_webui/models/feedbacks.py(+22 -0)📝
backend/open_webui/routers/evaluations.py(+38 -7)📄 Description
FIX: N+1 database query in feedbacks
Fix for solve the slowness when retrieving feedbacks, due to a N+1 database query problem in the implementation of evaluations endpoint.
Modify to use a single optimized query that joins feedback and user data.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.