Skip to content

Conversation

@rjgtav
Copy link
Contributor

@rjgtav rjgtav commented Dec 9, 2025

What?

Updates upsertRow.ts to run the deletes/inserts for related tables in parallel.

Why?

To optimize the total request time when creating/updating new entries on collections with relationships and other advanced fields (e.g. number field with hasMany, text field with hasMany, locales). Particularly impactful when the database is further away from the Payload instance.

How?

By collecting the delete/insert operations and running all of them at the end.

@rjgtav rjgtav marked this pull request as draft December 9, 2025 18:52
@rjgtav rjgtav force-pushed the rjgtav/perf-drizzle-upsertrow-parallel branch from ac03c0d to da07846 Compare December 9, 2025 19:31
@rjgtav rjgtav marked this pull request as ready for review December 9, 2025 20:02
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do the same with insertArrays

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AlessioGr ! Just submitted a new commit which goes further in parallelizing the different steps. Is this what you were thinking about?

@rjgtav rjgtav force-pushed the rjgtav/perf-drizzle-upsertrow-parallel branch from 5753f1f to f54cc04 Compare December 10, 2025 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants