You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So turns out you can avoid building long queries on bulk insert by using
arrays:
insert into measurements (sensor_id, value, captured_at)
select * from unnest(
$1::int[], -- array of sensor ids
$2::float[], -- array of values
$3::timestamptz[] -- array of timestamps
);
(from https://boringsql.com/posts/good-bad-arrays/#bulk-loading-with-arrays)
This is ... kind of obvious, but I never realized until now 😅
This is much nicer as it won't spam pg_stat_statements etc. with
"different" queries.
Most of this is in zdb:
arp242/zdb@1be9d14
0 commit comments