DO LANGUAGE plpgsql $$
  DECLARE
    v1 INT8 DEFAULT 10000;
    v2 INT8 DEFAULT 10000;
    n INT4 DEFAULT 2000000000;
    t TEXT;
    s TEXT;
    o TEXT;
    r BOOLEAN;
    t0 TIMESTAMP;
  BEGIN
    FOREACH s IN ARRAY ARRAY['16', '32', '64'] LOOP
      FOREACH t IN ARRAY ARRAY['int', 'uint' ] LOOP
        FOREACH o IN ARRAY ARRAY['mul', 'add', 'sub'] LOOP
          t0 := clock_timestamp();
          r := pg_overflow_check(v1, v2, n, t || s, o); 
          RAISE NOTICE '% % %: %', t, s, o, clock_timestamp() - t0;
        END LOOP;
      END LOOP;
    END LOOP;
  END;
$$;
