
create table employees_big
(
	employee_id serial not null primary key,
	first_name varchar(20),
	last_name varchar(25) not null,
	email varchar(25) not null,
	phone_number varchar(20),
	hire_date date not null,
	job_id varchar(10) not null,
	salary numeric,
	commission_pct numeric,
	manager_id integer,
	department_id integer
);

insert into employees_big (first_name, last_name, email, phone_number, hire_date, job_id, salary, commission_pct, manager_id, department_id)
SELECT
	'first name '  || floor(random() * 10000),
	'last name ' || floor(random() * 100000),
	'email ' || i,
	i,
	date '1990-01-01' + cast(floor(random() * 20 * 365) as integer),
	case floor(random() * 9)
		 when 0 then 'IT_PROG'
		 when 1 then 'AC_ACCOUNT'
		 when 2 then 'AC_MGR'
		 when 3 then 'MK_REP'
		 when 4 then 'ST_CLERK'
		 when 5 then 'AD_ASST'
		 when 6 then 'SA_REP'
		 when 7 then 'SA_MAN'
		 when 8 then 'AC_ACCOUNT'
	end,
	floor(random()*20) * 1000,
	round(cast(random() as numeric),2),
	floor(random()*1000000),
	floor(random()*1000)
FROM generate_series(1,10000000) as s(i);

create index employees_salary on employees_big(salary);
create index employees_manager on employees_big(manager_id);