\! pgbench -i -s 100
CREATE TABLE pgbench_accounts_1 (CHECK (bid >= 1 and bid <= 20)) INHERITS (pgbench_accounts);
CREATE TABLE pgbench_accounts_2 (CHECK (bid >= 21 and bid <= 40)) INHERITS (pgbench_accounts);
CREATE TABLE pgbench_accounts_3 (CHECK (bid >= 41 and bid <= 60)) INHERITS (pgbench_accounts);
CREATE TABLE pgbench_accounts_4 (CHECK (bid >= 61 and bid <= 80)) INHERITS (pgbench_accounts);
CREATE TABLE pgbench_accounts_5 (CHECK (bid >= 81 and bid <= 100)) INHERITS (pgbench_accounts);

WITH del AS (DELETE FROM pgbench_accounts WHERE bid >= 1 and bid <= 20 RETURNING *) INSERT INTO pgbench_accounts_1 SELECT * FROM del;
WITH del AS (DELETE FROM pgbench_accounts WHERE bid >= 21 and bid <= 40 RETURNING *) INSERT INTO pgbench_accounts_2 SELECT * FROM del;
WITH del AS (DELETE FROM pgbench_accounts WHERE bid >= 41 and bid <= 60 RETURNING *) INSERT INTO pgbench_accounts_3 SELECT * FROM del;
WITH del AS (DELETE FROM pgbench_accounts WHERE bid >= 61 and bid <= 80 RETURNING *) INSERT INTO pgbench_accounts_4 SELECT * FROM del;
WITH del AS (DELETE FROM pgbench_accounts WHERE bid >= 81 and bid <= 100 RETURNING *) INSERT INTO pgbench_accounts_5 SELECT * FROM del;

