Fix Query performance for cc_side agent

For some unexplained reason, including the `"and cc_side != 'agent'` in the WHERE tanks the query performance from seconds to minutes on Postgres 9.4. It runs great on Postgresql 13. Reverting to the "blank content while writing the page content" approach for this value unless I can find the source of the problem. - Oh, also removed an unnecessary condition that prevents you from filtering by LOSE_RACE.
This commit is contained in:
demonspork 2021-02-20 02:57:08 -06:00
parent 92dc62a7b4
commit 77974b71dc
2 changed files with 5 additions and 6 deletions

View File

@ -823,7 +823,10 @@
}
$content .= "</tr>\n";
//show agent originated legs only to those with the permission
if (!permission_exists('xml_cdr_cc_agent_leg') && $row['cc_side'] == "agent") {
$content = '';
}
//show the leg b only to those with the permission
if ($row['leg'] == 'a') {
echo $content;

View File

@ -413,7 +413,7 @@
$sql .= "and billsec like :billsec ";
$parameters['billsec'] = '%'.$billsec.'%';
}
if (strlen($hangup_cause) > 0 && $hangup_cause != 'LOSE_RACE') {
if (strlen($hangup_cause) > 0) {
$sql .= "and hangup_cause like :hangup_cause ";
$parameters['hangup_cause'] = '%'.$hangup_cause.'%';
}
@ -515,10 +515,6 @@
$sql .= "and (c.record_path is null or c.record_name is null) ";
}
}
//show agent originated legs only to those with the permission
if (!permission_exists('xml_cdr_cc_agent_leg')) {
$sql .= "and cc_side != 'agent' ";
}
//end where
if (strlen($order_by) > 0) {
$sql .= order_by($order_by, $order);