Skip to content

Commit 0a700c7

Browse files
committed
Further improve commit c85bee6
The status/direction filtering is redundant (and SLOW, since these columns are not indexed), as the calls are already grouped by Call-ID! (cherry picked from commit 54f52c9)
1 parent e992d20 commit 0a700c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

web/tools/system/siptrace/template/tracer.main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
else if ($config->db_driver == "pgsql")
140140
$sql = "SELECT DISTINCT ON (callid) callid FROM ".$table." WHERE status='' AND direction='in'".$sql_search." ORDER BY callid DESC";
141141

142-
$sql_cnt = "SELECT COUNT(DISTINCT(callid)) FROM ".$table." WHERE status='' AND direction='in'".$sql_search." ORDER BY callid DESC";
142+
$sql_cnt = "SELECT COUNT(DISTINCT(callid)) FROM ".$table." WHERE (1=1) ".$sql_search;
143143
} else {
144144
$sql = "SELECT id FROM ".$table." WHERE (1=1) ".$sql_search." ORDER BY id DESC";
145145
$sql_cnt = "SELECT COUNT(*) FROM ".$table." WHERE (1=1) ".$sql_search;

0 commit comments

Comments
 (0)