wiki:CLC upstream

Version 1 (modified by cedric, 15 years ago) (diff)

--

Trial on the Vilaine

select sum(catchment_area) as up_catchment_area,
sum(artificial_surfaces_11_13) as up_artificial_surfaces_11_13,
sum(artificial_vegetated_14) as up_artificial_vegetated_14,
sum(arable_land_21) as up_arable_land_21,
sum(permanent_crops_22) as up_permanent_crops_22,
sum(pastures_23) as up_pastures_23,
sum(heterogeneous_agricultural_24) as up_heterogeneous_agricultural_24,
sum(forest_31) as up_forest_31,
sum(natural_32_33) as up_natural_32_33,
sum(wetlands_4) as up_wetland_4,
sum(inland_waterbodies_51) as up_inland_waterbodies_51,
sum(marine_water_52) as up_marine_water_52
from clc.surf_area_final
where  "gid" IN (select ccm21.upstream_segments(272506))

to gain 80 % speed

CREATE INDEX index_clc_surf_area_final
  ON clc.surf_area_final
  USING btree
  (gid);