drop table if exists t;
create table t (a int, b text);
insert into t select i, (select string_agg(md5(random()::text), '') from generate_series(1,100)) from generate_series(1,100000) s(i);
copy t to '/tmp/t.data';
drop table t;

create or replace function trig_all() returns trigger as $$
begin
  return new;
end; $$ language plpgsql;

create or replace function trig_none() returns trigger as $$
begin
  return null;
end; $$ language plpgsql;


\timing on

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;





checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;







checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;





checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;





checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_all();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;







checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

checkpoint;

begin;
create unlogged table t (a int, b text);
CREATE TRIGGER ins BEFORE INSERT ON t FOR EACH ROW EXECUTE PROCEDURE trig_none();
copy t from '/tmp/t.data' freeze;
commit;

vacuum t;
drop table t;

