From c97d9e7022814c9d243400dd6666155b1922ec05 Mon Sep 17 00:00:00 2001 From: emaktech Date: Mon, 7 Dec 2020 15:56:26 -0500 Subject: [PATCH] Order by start_epoch to Speed Up Query Execution In some cases, this seems to speed up xml_cdr loading times by ~10x. It appears one big cause of this is the final ORDER_BY statements are very slow in PostgreSQL for timestamp fields. Ordering by start_epoch field improves query execution time in a dramatic way and should result in the same ordering. --- app/xml_cdr/xml_cdr_inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/xml_cdr/xml_cdr_inc.php b/app/xml_cdr/xml_cdr_inc.php index bb10bfb56e..e9661be3bf 100644 --- a/app/xml_cdr/xml_cdr_inc.php +++ b/app/xml_cdr/xml_cdr_inc.php @@ -187,7 +187,7 @@ } //create the sql query to get the xml cdr records - if (strlen($order_by) == 0) { $order_by = "start_stamp"; } + if (strlen($order_by) == 0) { $order_by = "start_epoch"; } if (strlen($order) == 0) { $order = "desc"; } //set a default number of rows to show