drop table if exists test3;

create unlogged table test3 (
         id integer PRIMARY KEY with (fillfactor=85),
         val text
     ) WITH (fillfactor=85);

insert into test3 select i, '!'||i from generate_series(1, 10000000) as i;

vacuum analyze; checkpoint;

create or replace function dotest3(n int, scale float8) returns void
language plpgsql as $$
begin
for i in 1..n loop
  declare
    id1 int := random() * scale;
    id2 int := random() * scale;
  begin
    perform * from test3 where id = id1;
    update test3 set val = '!'|| id2 where id = id1;
  end;
end loop;
end $$;
