ppetzold / nestjs-paginate

Pagination and filtering helper method for TypeORM repositories or query builders using Nest.js framework :book::paperclip:
MIT License
448 stars 100 forks source link

Performance Issues with Query Builder #1005

Open wisac opened 1 month ago

wisac commented 1 month ago

Hello,

I'm really enjoying using this library in my project, and it's making things much easier for me. However, I'm currently facing a performance issue when using the Query Builder with nestjs-paginate.

When I use paginate with the Query Builder, the average query execution time is around 5 seconds. In contrast, when I use the repository with nest-paginate, the same query executes in less than 1 second. Occasionally, the performance improves slightly, but it tends to revert to being slow again. I understand my paginate config and relations could be affecting performance but I use the same paginate config for the repository and it works fine

For context, I'm using PostgreSQL 16 running on localhost

Any help or insights would be greatly appreciated.

Thanks!

CODE: Screenshot from 2024-10-17 23-26-22

WITH QUERY BUILDER (TIME IN MILLISEC): Screenshot from 2024-10-17 23-33-54

WITH REPO (TIME IN MILLISEC): Screenshot from 2024-10-17 23-37-06

Helveg commented 1 month ago

Perhaps related to: https://github.com/ppetzold/nestjs-paginate/issues/329 ?

jongomes commented 2 weeks ago

+1