mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
Prisma's debug logger keeps the arguments of its last hundred calls in memory whether or not logging is on, and the client and the Postgres adapter both log every statement with its parameters. A restore that wrote 1 000 readings per statement therefore kept a copy of about the last 100 000 readings alive for the whole measurement write: about 60 MB on 1.8 million Apple Health readings, next to a V8 heap limit of 524 MB in the default 1 GB container. The bulk insert now splits whatever it is handed into statements of at most 100 rows, which holds about 7 MB. The Apple Health export import goes through the same helper and gets the same bound. The write costs a little time: 94 s instead of 76 s for 1.8 million readings on a fast host. Refs #1031