Tom MacWright
10/28/2021, 6:24 PM.upsert calls is a bottleneck in my app, so I'm trying to switch to either createMany with ignoring duplicates, or queryRaw. I'm hitting the issues that (1) there's no upsertMany. (2) createMany doesn't return the duplicated rows and updateMany doesn't let you specify multiple where conditions, and (3) queryRaw doesn't appear to support arrays-of-arrays as arguments. This is a bit of a bummer. I'm trying to just have some raw SQL in this part of my app because the ORM-unoptimized version is not sufficient, but the queryRaw bit doesn't seem to work either for this usecase.Austin Zentz
10/28/2021, 7:32 PMAustin Zentz
10/28/2021, 7:55 PMAustin Zentz
10/28/2021, 7:56 PMTom MacWright
10/28/2021, 7:57 PMTom MacWright
10/28/2021, 7:57 PM::jsonbTom MacWright
10/28/2021, 7:57 PMAustin Zentz
10/28/2021, 8:02 PMTom MacWright
10/28/2021, 8:30 PMTom MacWright
10/28/2021, 8:31 PMUNNEST, lots of explicit casting with ::, and debugging the query outside of prismaTom MacWright
10/28/2021, 8:31 PMTom MacWright
10/28/2021, 8:32 PMAustin Zentz
10/28/2021, 8:36 PMAustin Zentz
10/28/2021, 8:36 PM$3::int[] syntax is new to me. looks useful.Tom MacWright
10/28/2021, 8:37 PMzip here is the lodash zip method, which changes an array of [a, b, c] into arrays of [a, a, a], etc, then you unnest that into a list of rows you select from, cast, etc