DO $$
DECLARE
    i INTEGER;
BEGIN
    FOR i IN 1..300000 LOOP
        EXECUTE format('CREATE TABLE IF NOT EXISTS test_table%s (f1 int, f2 int)', i);
    END LOOP;
END;
$$;

DO $$
DECLARE
    i INTEGER;
BEGIN
    FOR i IN 300001..600000 LOOP
        EXECUTE format('CREATE TABLE IF NOT EXISTS test_table%s (f1 int, f2 int)', i);
    END LOOP;
END;
$$;


DO $$
DECLARE
    i INTEGER;
BEGIN
    FOR i IN 600001..1000000 LOOP
        EXECUTE format('CREATE TABLE IF NOT EXISTS test_table%s (f1 int, f2 int)', i);
    END LOOP;
END;
$$;


BEGIN;

DO $$
DECLARE
    i INTEGER;
BEGIN
    FOR i IN 1..950000 LOOP
        EXECUTE format('LOCK TABLE test_table%s', i);
    END LOOP;
END;
$$;

SELECT pg_sleep(7200)
