-- Run this script to create three tables of different widths, used in
-- the COPY tests. This also generates some dummy data in the tables, and
-- dumps the data to files in /tmp/. The COPY tests measure the time needed
-- to load those files back into the tables.


CREATE TABLE narrowtable (id int4);
INSERT INTO narrowtable SELECT generate_series(1,50000000);
COPY narrowtable TO '/tmp/narrowtable';


CREATE TABLE midtable (id int4, n numeric, col3 text, col4 text);
INSERT INTO midtable SELECT a, (a::numeric)*1000, 'bar' || a, 'foooooooooooobar' || a FROM generate_series(1,5000000) a;
COPY midtable TO '/tmp/midtable';

CREATE TABLE widetable (id int4, n numeric, col3 text, col4 text, col5 text, col6 text, col7 text, col8 text, col9 text, col10 text, col11 text, col12 text, col13 text);
INSERT INTO widetable
SELECT a,
       a*1000,
	'3colllllllllllllllllllllll' || a,
	'4colllllllllllllllllllllll' || a,
	'5colllllllllllllllllllllll' || a,
	'6colllllllllllllllllllllll' || a,
	'7colllllllllllllllllllllll' || a,
	'8colllllllllllllllllllllll' || a,
	'9colllllllllllllllllllllll' || a,
	'10colllllllllllllllllllllll' || a,
	'11colllllllllllllllllllllll' || a,
	'12colllllllllllllllllllllll' || a,
	'13colllllllllllllllllllllll' || a
FROM generate_series(1,2000000) a;
COPY widetable TO '/tmp/widetable';
