From bc15f39f530bb007536cab4a4c2c6a1260f4103f Mon Sep 17 00:00:00 2001 From: John Date: Tue, 13 Oct 2015 10:21:14 +0100 Subject: [PATCH] For #21, removes aggregation on VC column for performance Only outputs the VC if the record is fully contained within. Therefore no need to aggregate if records overlap boundaries. --- reports/library/occurrences/filterable_nbn_exchange.xml | 8 ++++---- .../occurrences/filterable_occurrences_download.xml | 8 ++++---- .../occurrences/filterable_occurrences_download_gis.xml | 8 ++++---- .../filterable_occurrences_download_parent_samples.xml | 8 ++++---- .../filterable_occurrences_download_sensitive.xml | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/reports/library/occurrences/filterable_nbn_exchange.xml b/reports/library/occurrences/filterable_nbn_exchange.xml index 1a041521cb..39c88b8431 100644 --- a/reports/library/occurrences/filterable_nbn_exchange.xml +++ b/reports/library/occurrences/filterable_nbn_exchange.xml @@ -7,9 +7,9 @@ select #columns# from cache_occurrences o join samples s on s.id=o.sample_id left join (index_locations_samples ils - join locations l on l.id=ils.location_id - join cache_termlists_terms ctt on ctt.id=l.location_type_id and ctt.term='Vice County' -) on ils.sample_id=o.sample_id + join locations vc on vc.id=ils.location_id + join cache_termlists_terms ctt on ctt.id=vc.location_type_id and ctt.term='Vice County' +) on ils.sample_id=o.sample_id and ils.contains=true left join groups g1 on g1.id=o.group_id and g1.deleted=false left join group_relations grel on grel.to_group_id=g1.id and grel.deleted=false left join groups g2 on g2.id=grel.from_group_id and g2.deleted=false @@ -57,7 +57,7 @@ and st_y(st_transform(st_centroid(public_geom), 4326)) between -48 and 62 else case length(replace(s.entered_sref, ' ', '')) when 5 then 2000 else pow(10, (12-length(replace(s.entered_sref, ' ', '')))/2) end end" datatype="text" /> - + diff --git a/reports/library/occurrences/filterable_occurrences_download.xml b/reports/library/occurrences/filterable_occurrences_download.xml index f7b521e0e3..06ca3bc527 100644 --- a/reports/library/occurrences/filterable_occurrences_download.xml +++ b/reports/library/occurrences/filterable_occurrences_download.xml @@ -9,9 +9,9 @@ JOIN cache_taxa_taxon_lists cttl on cttl.id=o.taxa_taxon_list_id JOIN samples s on s.id=o.sample_id AND s.deleted=false LEFT JOIN (index_locations_samples ils - JOIN locations l on l.id=ils.location_id - JOIN cache_termlists_terms ctt on ctt.id=l.location_type_id AND ctt.term='Vice County' - ) on ils.sample_id=o.sample_id + JOIN locations vc on vc.id=ils.location_id + JOIN cache_termlists_terms ctt on ctt.id=vc.location_type_id AND ctt.term='Vice County' + ) on ils.sample_id=o.sample_id and ils.contains=true LEFT JOIN (occurrence_attribute_values det_full_val JOIN occurrence_attributes det_full on det_full.id=det_full_val.occurrence_attribute_id and det_full.deleted=false and det_full.system_function='det_full_name' ) ON det_full_val.occurrence_id=o.id AND det_full_val.deleted=false @@ -72,7 +72,7 @@ end" datatype="text" /> - + diff --git a/reports/library/occurrences/filterable_occurrences_download_gis.xml b/reports/library/occurrences/filterable_occurrences_download_gis.xml index a0c588bee4..86af7a791d 100644 --- a/reports/library/occurrences/filterable_occurrences_download_gis.xml +++ b/reports/library/occurrences/filterable_occurrences_download_gis.xml @@ -8,9 +8,9 @@ JOIN occurrences occ on occ.id=o.id and occ.deleted=false -- to get comments JOIN samples s on s.id=o.sample_id AND s.deleted=false LEFT JOIN (index_locations_samples ils - JOIN locations l on l.id=ils.location_id - JOIN cache_termlists_terms ctt on ctt.id=l.location_type_id AND ctt.term='Vice County' - ) on ils.sample_id=o.sample_id + JOIN locations vc on vc.id=ils.location_id + JOIN cache_termlists_terms ctt on ctt.id=vc.location_type_id AND ctt.term='Vice County' + ) on ils.sample_id=o.sample_id and ils.contains=true LEFT JOIN (occurrence_attribute_values det_full_val JOIN occurrence_attributes det_full on det_full.id=det_full_val.occurrence_attribute_id and det_full.deleted=false and det_full.system_function='det_full_name' ) ON det_full_val.occurrence_id=o.id AND det_full_val.deleted=false @@ -69,7 +69,7 @@ end" datatype="text" /> - + diff --git a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml index 924e98ef84..980b917a22 100644 --- a/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml +++ b/reports/library/occurrences/filterable_occurrences_download_parent_samples.xml @@ -9,9 +9,9 @@ JOIN cache_taxa_taxon_lists cttl on cttl.id=o.taxa_taxon_list_id JOIN samples s on s.id=o.sample_id AND s.deleted=false LEFT JOIN (index_locations_samples ils - JOIN locations l on l.id=ils.location_id - JOIN cache_termlists_terms ctt on ctt.id=l.location_type_id AND ctt.term='Vice County' - ) on ils.sample_id=o.sample_id + JOIN locations vc on vc.id=ils.location_id + JOIN cache_termlists_terms ctt on ctt.id=vc.location_type_id AND ctt.term='Vice County' + ) on ils.sample_id=o.sample_id and ils.contains=true LEFT JOIN (occurrence_attribute_values det_full_val JOIN occurrence_attributes det_full on det_full.id=det_full_val.occurrence_attribute_id and det_full.deleted=false and det_full.system_function='det_full_name' ) ON det_full_val.occurrence_id=o.id AND det_full_val.deleted=false @@ -72,7 +72,7 @@ end" datatype="text" /> - + diff --git a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml index 5231fc8779..64b0ede4b7 100644 --- a/reports/library/occurrences/filterable_occurrences_download_sensitive.xml +++ b/reports/library/occurrences/filterable_occurrences_download_sensitive.xml @@ -9,9 +9,9 @@ JOIN cache_taxa_taxon_lists cttl on cttl.id=o.taxa_taxon_list_id JOIN samples s on s.id=o.sample_id AND s.deleted=false LEFT JOIN (index_locations_samples ils - JOIN locations l on l.id=ils.location_id - JOIN cache_termlists_terms ctt on ctt.id=l.location_type_id AND ctt.term='Vice County' - ) on ils.sample_id=o.sample_id + JOIN locations vc on vc.id=ils.location_id + JOIN cache_termlists_terms ctt on ctt.id=vc.location_type_id AND ctt.term='Vice County' + ) on ils.sample_id=o.sample_id and ils.contains=true LEFT JOIN (occurrence_attribute_values det_full_val JOIN occurrence_attributes det_full on det_full.id=det_full_val.occurrence_attribute_id and det_full.deleted=false and det_full.system_function='det_full_name' ) ON det_full_val.occurrence_id=o.id AND det_full_val.deleted=false @@ -72,7 +72,7 @@ end" datatype="text" /> - +