| 1 | Trial on the Vilaine |
| 2 | {{{ |
| 3 | #!sql |
| 4 | select sum(catchment_area) as up_catchment_area, |
| 5 | sum(artificial_surfaces_11_13) as up_artificial_surfaces_11_13, |
| 6 | sum(artificial_vegetated_14) as up_artificial_vegetated_14, |
| 7 | sum(arable_land_21) as up_arable_land_21, |
| 8 | sum(permanent_crops_22) as up_permanent_crops_22, |
| 9 | sum(pastures_23) as up_pastures_23, |
| 10 | sum(heterogeneous_agricultural_24) as up_heterogeneous_agricultural_24, |
| 11 | sum(forest_31) as up_forest_31, |
| 12 | sum(natural_32_33) as up_natural_32_33, |
| 13 | sum(wetlands_4) as up_wetland_4, |
| 14 | sum(inland_waterbodies_51) as up_inland_waterbodies_51, |
| 15 | sum(marine_water_52) as up_marine_water_52 |
| 16 | from clc.surf_area_final |
| 17 | where "gid" IN (select ccm21.upstream_segments(272506)) |
| 18 | }}} |
| 19 | to gain 80 % speed |
| 20 | {{{ |
| 21 | CREATE INDEX index_clc_surf_area_final |
| 22 | ON clc.surf_area_final |
| 23 | USING btree |
| 24 | (gid); |
| 25 | }}} |