Description
Describe the Bug
hi,
i just upgraded from 3.33 to latest 3.40.0, i found performance regression on large mongodb collection with a relationship, its just not loading in UI, its taking 120+ seconds to show the records sometime not at all.
i tested downgrading payload version i found the issue started occurring since 3.39.0.
issue with a large collection with 38M records , the collection have a single relationship with another collection ,
{
name: 'categories',
type: 'relationship',
relationTo: 'product-categories',
hasMany: true,
},
i have another large collection with 229M records it loads fine as it doesn't have any relationship, it seems how relationships are pulled has changed.
i am using payload since v1 never had any issue like this ever.
Link to the code that reproduces this issue
kindly suggest how to make a reproduction for this
Reproduction Steps
to reproduce make a collection with about 10M records having a relationship like this (see below) , product-categories collection just have about 3000 records. try to load the collection in backend it will just not load or take a lot of time , compare same with payload 3.38.0 it works perfectly .
kindly suggest how to make a reproduction for this?
relationship field
{
name: 'categories',
type: 'relationship',
relationTo: 'product-categories',
hasMany: true,
}
Which area(s) are affected? (Select all that apply)
db-mongodb, area: ui
Environment Info
Binaries:
Node: 22.11.0
npm: 11.2.0
Yarn: 1.22.22
pnpm: 10.6.5
Relevant Packages:
payload: 3.39.0
next: 15.3.0
@payloadcms/db-mongodb: 3.39.0
@payloadcms/email-nodemailer: 3.39.0
@payloadcms/graphql: 3.39.0
@payloadcms/next/utilities: 3.39.0
@payloadcms/payload-cloud: 3.39.0
@payloadcms/plugin-seo: 3.39.0
@payloadcms/richtext-lexical: 3.39.0
@payloadcms/translations: 3.39.0
@payloadcms/ui/shared: 3.39.0
react: 19.0.0
react-dom: 19.0.0
Operating System:
Platform: linux
Arch: x64
Version: #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025
Available memory (MB): 112478
Available CPU cores: 12