From 72ae4a5471fcad689ab657645eacdfab2a7d27ea Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Fri, 21 Mar 2014 11:23:27 +0100 Subject: [PATCH] MT#4369 optimize mysql performance on callflow page distinct is faster than group by here drawback: we cannot select min(timestamp) anymore query is still very slow, when filter is used --- lib/NGCP/Panel/Controller/Callflow.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Controller/Callflow.pm b/lib/NGCP/Panel/Controller/Callflow.pm index f9981f815c..3ffdddbf38 100644 --- a/lib/NGCP/Panel/Controller/Callflow.pm +++ b/lib/NGCP/Panel/Controller/Callflow.pm @@ -21,7 +21,7 @@ sub root :Chained('/') :PathPart('callflow') :CaptureArgs(0) { my ( $self, $c ) = @_; $c->stash->{capture_dt_columns} = NGCP::Panel::Utils::Datatables::set_columns($c, [ - { name => "timestamp", search => 0, title => $c->loc('Timestamp'), literal_sql => "min(timestamp)" }, + { name => "timestamp", search => 0, title => $c->loc('Timestamp') }, { name => "call_id", search => 1, title => $c->loc('Call-ID') }, { name => "caller_uuid", search => 1, title => $c->loc('Caller UUID') }, { name => "callee_uuid", search => 1, title => $c->loc('Callee UUID') }, @@ -46,7 +46,8 @@ sub index :Chained('root') :PathPart('') :Args(0) { sub ajax :Chained('root') :PathPart('ajax') :Args(0) { my ( $self, $c ) = @_; my $calls_rs = $c->stash->{calls_rs}->search_rs(undef,{ - group_by => 'call_id' + select => [\'distinct(call_id)', 'caller_uuid', 'callee_uuid', 'cseq_method', 'timestamp'], + as => ['call_id', 'caller_uuid', 'callee_uuid', 'cseq_method', 'timestamp'], }); NGCP::Panel::Utils::Datatables::process( $c,