summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-04-25 13:37:07 -0700
committerIvan Kohler <ivan@freeside.biz>2017-04-25 13:37:07 -0700
commit8e31152753c243cbd3e67b36fb63e1e288963c61 (patch)
tree86ed1511d3c799e302e5fddbb61b10da92c6488a
parent9314b55f352d9ba389cd5c09d9eed2f0d2e9c83b (diff)
fix occasional bad query planning searching for CDRs, RT#74494
-rw-r--r--FS/FS/svc_phone.pm9
1 files changed, 8 insertions, 1 deletions
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;