Skip to content

perf(drizzle): 2x faster db.deleteMany - #13255

Merged
AlessioGr merged 5 commits into
mainfrom
perf/deletemany
Jul 25, 2025
Merged

AlessioGr merged 5 commits into
mainfrom
perf/deletemany

Conversation

@AlessioGr

@AlessioGr AlessioGr commented Jul 23, 2025 •

Copy link
Copy Markdown
Member

Previously, db.deleteMany on postgres resulted in 2 roundtrips to the database (find + delete with ids). This PR passes the where query directly to the deleteWhere function, resulting in only one roundtrip to the database (delete with where).

If the where query queries other tables (=> joins required), this falls back to find + delete with ids. However, this is also more optimized than before, as we now pass select: { id: true } to the findMany query.


@github-actions

github-actions Bot commented Jul 23, 2025 •

Copy link
Copy Markdown
Contributor

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖
This PR introduced no changes to the esbuild bundle! 🙌

@AlessioGr
AlessioGr merged commit 6d6c9eb into main Jul 25, 2025
@AlessioGr
AlessioGr deleted the perf/deletemany branch July 25, 2025 22:46
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