 -- Remove old indexes
 DROP INDEX IF EXISTS zaf.prob_hazard_gidx;
 DROP INDEX IF EXISTS zaf.demog_sas_gidx;
-DROP INDEX IF EXISTS prob_hazard_year_idx;
-DROP INDEX IF EXISTS prob_hazard_month_idx;
-DROP INDEX IF EXISTS tbl_pop_agegender_12y_sa_code_idx;
-DROP INDEX IF EXISTS demog_sas_sa_code_idx;
+DROP INDEX IF EXISTS zaf.tbl_pop_proj_dc_mdb_code_idx;
+DROP INDEX IF EXISTS zaf.prob_hazard_year_idx;
+DROP INDEX IF EXISTS zaf.prob_hazard_month_idx;
+DROP INDEX IF EXISTS zaf.tbl_pop_agegender_12y_sa_code_idx;
+DROP INDEX IF EXISTS zaf.demog_sas_sa_code_idx;
 
 -- Recreate them or create new ones
 CREATE INDEX prob_hazard_gidx ON zaf.prob_hazard USING GIST(the_geom);
 CREATE INDEX demog_sas_gidx ON zaf.demog_sas USING GIST(the_geom);
 CREATE INDEX tbl_pop_proj_dc_mdb_code_idx ON zaf.tbl_pop_proj(dc_mdb_code);
-CREATE INDEX prob_hazard_year_idx ON zaf.prob_hazard(year);
-CREATE INDEX prob_hazard_month_idx ON zaf.prob_hazard(month);
-CREATE INDEX tbl_pop_agegender_12y_sa_code_idx ON zaf.tbl_pop_agegender_12y(sa_code);
-CREATE INDEX demog_sas_sa_code_idx ON zaf.demog_sas(sa_code);
+CREATE INDEX prob_hazard_year_idx ON zaf.prob_hazard (year);
+CREATE INDEX prob_hazard_month_idx ON zaf.prob_hazard (month);
+CREATE INDEX tbl_pop_agegender_12y_sa_code_idx ON zaf.tbl_pop_agegender_12y (sa_code);
+CREATE INDEX demog_sas_sa_code_idx ON zaf.demog_sas (sa_code);
 
 --ALTER TABLE zaf.demog_sas_ofa_1 ADD COLUMN pop_curr numeric;
 

							total AS pop_size,
							total * pop_c / pop_y AS pop_curr,
							lz_code,
							'drought' AS lz_affected
						FROM
							zaf.demog_sas AS g,
							zaf.tbl_pop_agegender_12y AS h,

	deficit
	)
		SELECT
			the_geom AS the_geom,
			ofa_year,
			ofa_month,
			sa_code,
			mn_name,
			dc_code,
			dc_name,
			pr_name,
			pop_size,
			pop_curr,
			v.lz_code,
			lz_abbrev,
			lz_name,
			wg_name,
			pc_wg,
			hh_size,
			v.lz_affected,
			wg_affected,
			pc_wg_affected,
			threshold,
