-- 60% NULLs
INSERT INTO demo_hot.fact_events (row_id, tenant_id, lookup_key, created_at)
SELECT
(substr(md5('row-null-' || gs::text),1,8) || '-' ||
substr(md5('row-null-' || gs::text),9,4) || '-' ||
substr(md5('row-null-' || gs::text),13,4) || '-' ||
substr(md5('row-null-' || gs::text),17,4) || '-' ||
substr(md5('row-null-' || gs::text),21,12))::uuid AS row_id,
(substr(md5('tenant-' || (gs % 100)::text),1,8) || '-' ||
substr(md5('tenant-' || (gs % 100)::text),9,4) || '-' ||
substr(md5('tenant-' || (gs % 100)::text),13,4) || '-' ||
substr(md5('tenant-' || (gs % 100)::text),17,4) || '-' ||
substr(md5('tenant-' || (gs % 100)::text),21,12))::uuid AS tenant_id,
NULL::bigint AS lookup_key,
now() - (gs % 86400) * interval '1 second' AS created_at
FROM generate_series(1, 60000) gs;
-- 40% non-NULL keys
INSERT INTO demo_hot.fact_events (row_id, tenant_id, lookup_key, created_at)
SELECT
(substr(md5('row-key-' || k::text),1,8) || '-' ||
substr(md5('row-key-' || k::text),9,4) || '-' ||
substr(md5('row-key-' || k::text),13,4) || '-' ||
substr(md5('row-key-' || k::text),17,4) || '-' ||
substr(md5('row-key-' || k::text),21,12))::uuid AS row_id,
(substr(md5('tenant-' || (k % 100)::text),1,8) || '-' ||
substr(md5('tenant-' || (k % 100)::text),9,4) || '-' ||
substr(md5('tenant-' || (k % 100)::text),13,4) || '-' ||
substr(md5('tenant-' || (k % 100)::text),17,4) || '-' ||
substr(md5('tenant-' || (k % 100)::text),21,12))::uuid AS tenant_id,
k::bigint AS lookup_key,
now() - (k % 86400) * interval '1 second' AS created_at
FROM generate_series(1, 40000) k;