Skip to content

Commit

Permalink
Switched to cache_occurrences_functional
Browse files Browse the repository at this point in the history
Better performance if all filtering done in one table.
  • Loading branch information
johnvanbreda committed Nov 12, 2016
1 parent 5d1d346 commit 19aaf96
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
5 changes: 1 addition & 4 deletions application/helpers/report_standard_params_occurrences.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,9 @@ public static function getParameters() {
),
'identification_difficulty' => array('datatype'=>'integer', 'default'=>'', 'display'=>'Identification difficulty',
'description'=>'Identification difficulty on a scale of 1 to 5',
'joins' => array(
array('value'=>'', 'operator'=>'', 'standard_join'=>'prefcttl')
),
'wheres' => array(
array('value'=>'', 'operator'=>'',
'sql'=>"coalesce(cttl.identification_difficulty, 0) #identification_difficulty_op# #identification_difficulty#")
'sql'=>"coalesce(o.identification_difficulty, 0) #identification_difficulty_op# #identification_difficulty#")
)
),
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE cache_occurrences_functional ADD COLUMN identification_difficulty integer;

COMMENT ON COLUMN cache_occurrences_functional.identification_difficulty IS
'Identification difficulty assigned by the data_cleaner module, on a scale from 1 (easy) to 5 (difficult)';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-- #slow script#

update cache_taxa_taxon_lists cttl
update cache_occurrences_functional o
set identification_difficulty=vrd.value::integer
from verification_rule_data vrd
join verification_rules vr on vr.id=vrd.verification_rule_id and vr.deleted=false
and vr.test_type='IdentificationDifficulty'
where vrd.header_name='Data' and upper(vrd.key)=cttl.external_key and vrd.deleted=false;
where vrd.header_name='Data' and upper(vrd.key)=o.taxa_taxon_list_external_key and vrd.deleted=false;

This file was deleted.

0 comments on commit 19aaf96

Please sign in to comment.