YErii
06/03/2021, 8:45 AMconst v = await prisma.user.findMany({
where: {id: {notIn: Array.from({length: 6000}, (v, idx) => idx.toString())}}
})
const total = await prisma.user.findMany({
where: {}
})
console.log(v.length, total)
this should reproduct the problem.Ryan
06/03/2021, 9:45 AMconsole.log(await prisma.user.findMany({ where: { id: { notIn: [1, 2] } } }))Ryan
06/03/2021, 9:45 AMYErii
06/03/2021, 9:51 AMYErii
06/03/2021, 9:52 AMYErii
06/03/2021, 9:52 AMYErii
06/03/2021, 9:54 AMselect xxx where xxx not in ($1,$2, ..., $5000) + select xxx where xxx not in ($1,$2, ..., $1000)
prisma will execute these 2 sql and merge the results which is not right.YErii
06/03/2021, 9:55 AMtotal - 5000 + total - 1000 is not equal with total - 6000Ryan
06/03/2021, 10:02 AMQUERY_BATCH_SIZE=10000
So that it takes the amount of items you want to query in a batch. Also it would be great if you could persist this as an issue here.YErii
06/03/2021, 10:25 AMin operator will not chunk items into 5000YErii
06/03/2021, 10:32 AMRyan
06/03/2021, 10:34 AMQUERY_BATCH_SIZEYErii
06/03/2021, 10:37 AMQUERY_BATCH_SIZE , the In operator and NOT: {in: {xx}} will not chunk and return the right result.Ryan
06/03/2021, 10:41 AMYErii
06/03/2021, 10:45 AM