
DO $$
BEGIN
  for i in 1 .. 1000 loop
      EXECUTE 'CREATE SCHEMA SCHEMA' ||i;
    for j in 1 .. 50 loop
      execute 'create table schema'||i||'.table'||j||' (column1 text primary key, column2 text, column3 text, column4 text, column5 text)';
      commit;
    end loop;
  end loop;

END; $$