Use a more efficient SQL when finding Orphaned Frames

pull/2082/head
Isaac Connor 2018-04-17 08:47:11 -07:00
parent 34111251d9
commit 7e7e353a8c
1 changed files with 1 additions and 1 deletions

View File

@ -537,7 +537,7 @@ MAIN: while( $loop ) {
$cleaned = 0; $cleaned = 0;
Debug("Checking for Orphaned Frames"); Debug("Checking for Orphaned Frames");
my $selectOrphanedFramesSql = 'SELECT DISTINCT EventId FROM Frames my $selectOrphanedFramesSql = 'SELECT DISTINCT EventId FROM Frames
WHERE EventId NOT IN (SELECT Id FROM Events)'; WHERE (SELECT COUNT(*) FROM Events WHERE Events.Id=EventId)=0';
my $selectOrphanedFramesSth = $dbh->prepare_cached( $selectOrphanedFramesSql ) my $selectOrphanedFramesSth = $dbh->prepare_cached( $selectOrphanedFramesSql )
or Fatal( "Can't prepare '$selectOrphanedFramesSql': ".$dbh->errstr() ); or Fatal( "Can't prepare '$selectOrphanedFramesSql': ".$dbh->errstr() );
$res = $selectOrphanedFramesSth->execute() $res = $selectOrphanedFramesSth->execute()