delvaze
delvaze
DTDrizzle Team
Created by delvaze on 4/3/2024 in #help
Is there a way to return the number of rows that were deleted?
I'm doing a batch delete of hundreds of thousands of records and I'm wondering if there's a way to return the amount of rows that were deleted to make sure that my expectations match reality. Currently I'm doing this:
const res = await tx
.delete(activity)
.where(inArray(activity.id, numQuery))
.returning({ id: activity.id })

logger.info({ count: res.length }, 'delete dry run')
const res = await tx
.delete(activity)
.where(inArray(activity.id, numQuery))
.returning({ id: activity.id })

logger.info({ count: res.length }, 'delete dry run')
But this is not ideal for large arrays.
3 replies