fix occasional bad query planning searching for CDRs, RT#74494
authorIvan Kohler <ivan@freeside.biz>
Tue, 25 Apr 2017 20:37:11 +0000 (13:37 -0700)
committerIvan Kohler <ivan@freeside.biz>
Tue, 25 Apr 2017 20:37:11 +0000 (13:37 -0700)
FS/FS/svc_phone.pm

index 0c42832..ccc28a0 100644 (file)
@@ -852,8 +852,15 @@ the entire result set.
 =cut
 
 sub psearch_cdrs {
-
   my($self, %options) = @_;
+
+  unless ( $options{'billsec_sum'} ) {
+    #fixes a weird sequential scan of the whole cdr table on startdate, but only
+    # for a few charged_party values here and there.
+    # Pg 9.1 only?  need to retest on 9.4, 9.6
+    dbh->do('SET enable_indexscan TO OFF');
+  }
+
   my @fields;
   my %hash;
   my @where;