[open-ils-commits] r16953 - trunk/Open-ILS/src/perlmods/OpenILS/Application (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jul 15 22:37:26 EDT 2010
Author: miker
Date: 2010-07-15 22:37:24 -0400 (Thu, 15 Jul 2010)
New Revision: 16953
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
Log:
use a left join instead of -not-exists for anti-join -- much faster for large nullable-side sets in this case
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm 2010-07-15 22:01:29 UTC (rev 16952)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger.pm 2010-07-16 02:37:24 UTC (rev 16953)
@@ -453,17 +453,17 @@
push @{ $$filter{'-and'} }, $f;
}
- push @{ $filter->{'-and'} }, {
- '-not-exists' => {
- from => 'atev',
- where => {
- event_def => $def->id,
- target => { '=' => { '+' . $hook_hash{$def->hook}->core_type => $class->Identity } },
- ($active ? (state => 'pending') : ())
- }
+ my $join = { 'join' => {
+ atev => {
+ field => 'target',
+ fkey => $class->Identity,
+ type => 'left',
+ filter => { event_def => $def->id }
}
- };
+ }};
+ push @{ $filter->{'-and'} }, { '+atev' => { id => undef } };
+
if ($def->usr_field && $def->opt_in_setting) {
push @{ $filter->{'-and'} }, {
'-exists' => {
@@ -487,7 +487,7 @@
$logger->info("trigger: create_batch_events() collecting object IDs for def=$def_id / hook=$hook");
- my $object_ids = $editor->$method( $filter, {idlist => 1, timeout => 10800} );
+ my $object_ids = $editor->$method( [$filter, $join], {idlist => 1, timeout => 10800} );
if($object_ids) {
$logger->info("trigger: create_batch_events() fetched ".scalar(@$object_ids)." object IDs for def=$def_id / hook=$hook");
More information about the open-ils-commits
mailing list