Revision 13926
Added by Aaron Marcuse-Kubitza over 10 years ago
vegbien.sql | ||
---|---|---|
6146 | 6146 |
|
6147 | 6147 |
|
6148 | 6148 |
-- |
6149 |
-- Name: iucn_red_list; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
6150 |
-- |
|
6151 |
|
|
6152 |
CREATE TABLE iucn_red_list ( |
|
6153 |
accepted_family text NOT NULL, |
|
6154 |
accepted_species_binomial text NOT NULL |
|
6155 |
); |
|
6156 |
|
|
6157 |
|
|
6158 |
-- |
|
6149 | 6159 |
-- Name: 2014-6-4.Iara_Lacher.reserve_prioritization; Type: VIEW; Schema: public; Owner: - |
6150 | 6160 |
-- |
6151 | 6161 |
|
... | ... | |
6163 | 6173 |
analytical_stem."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" AS dbh_cm, |
6164 | 6174 |
analytical_stem."stemHeight[_m]__@VegBank__.stemCount@vegpath.org" AS height_m, |
6165 | 6175 |
analytical_stem."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" AS lifeform, |
6166 |
in_iucn_red_list(analytical_stem.scrubbed_family, analytical_stem.scrubbed_species_binomial) AS is_threatened_iucn |
|
6167 |
FROM analytical_stem |
|
6176 |
(iucn_red_list.accepted_family IS NOT NULL) AS is_threatened_iucn |
|
6177 |
FROM (analytical_stem |
|
6178 |
LEFT JOIN iucn_red_list ON (((iucn_red_list.accepted_family = analytical_stem.scrubbed_family) AND (iucn_red_list.accepted_species_binomial = analytical_stem.scrubbed_species_binomial)))) |
|
6168 | 6179 |
WHERE (((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND in_south_america(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org")) AND COALESCE((analytical_stem."taxonomicStatus__@DwC__@vegpath.org" = 'accepted'::text), false)); |
6169 | 6180 |
|
6170 | 6181 |
|
... | ... | |
9607 | 9618 |
|
9608 | 9619 |
|
9609 | 9620 |
-- |
9610 |
-- Name: iucn_red_list; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
9611 |
-- |
|
9612 |
|
|
9613 |
CREATE TABLE iucn_red_list ( |
|
9614 |
accepted_family text NOT NULL, |
|
9615 |
accepted_species_binomial text NOT NULL |
|
9616 |
); |
|
9617 |
|
|
9618 |
|
|
9619 |
-- |
|
9620 | 9621 |
-- Name: iucn_red_list_view; Type: VIEW; Schema: public; Owner: - |
9621 | 9622 |
-- |
9622 | 9623 |
|
Also available in: Unified diff
fix: schemas/public_.sql: 2014-6-4.Iara_Lacher.reserve_prioritization: is_threatened_iucn: generate this much faster by doing a LEFT JOIN, which can reuse the same in-memory hash index for every row