From 8e31152753c243cbd3e67b36fb63e1e288963c61 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 25 Apr 2017 13:37:07 -0700 Subject: [PATCH] fix occasional bad query planning searching for CDRs, RT#74494 --- FS/FS/svc_phone.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 725092edb..c2250c111 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -864,8 +864,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; -- 2.11.0