Performance Issue with Joins - Query Taking 1.3-1.6s vs 300ms Without Joins #12713
Unanswered
only-issues
asked this question in
Q&A
Replies: 1 comment
-
Can you try same query using createdAt in sort and post the result , having similar issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone! 👋
I'm experiencing a significant performance issue with joins in Payload CMS and wondering if anyone has encountered something similar or has suggestions for optimization.
The Setup
MongoDB
I have a comic reading platform with two main collections:
Comics Collection with a join field:
Chapters Collection with a unique index:
The Problem
When I fetch the latest 20 comics with their 2 most recent chapters:
Performance Results:
Database Scale
What I've Tried
['comic', 'chapterNumber']
Questions
Is this expected behavior for joins with this amount of data, or am I missing something in my configuration?
Are there any optimization strategies specifically for Payload joins that I should be aware of?
Custom query options: I noticed Payload doesn't seem to expose direct database query customization - is there a way to optimize the underlying queries being generated?
Alternative approaches: Would it be better to make separate queries and manually combine the results, or are there other patterns that work better for this use case?
The performance difference is quite significant (5x slower), and I'm wondering if this is something that can be optimized within Payload's join system or if I need to rethink my data fetching strategy.
Any insights or similar experiences would be greatly appreciated! Thanks in advance! 🙏
Beta Was this translation helpful? Give feedback.
All reactions