From f931ac0d7e1b460d5576c5941fad802eb5694c9c Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 4 Oct 2018 01:17:35 +0000 Subject: [PATCH] Added optimize of cid_channels_recent_ tables to flush-DB script git-svn-id: svn://192.168.202.10@3049 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/AST_flush_DBqueue.pl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/AST_flush_DBqueue.pl b/bin/AST_flush_DBqueue.pl index 8ad66780..89d2e0e8 100644 --- a/bin/AST_flush_DBqueue.pl +++ b/bin/AST_flush_DBqueue.pl @@ -25,6 +25,7 @@ # 180112-0915 - Added flush for cid_channels_recent table # 180511-1223 - Added flush for server-specific cid_channels_recent_ tables # 180519-1431 - Added vicidial_inbound_groups optimization +# 181003-2115 - Added optimize of cid_channels_recent_ tables # ### begin parsing run-time options ### @@ -408,6 +409,19 @@ while ($sthArows > $aas) if($DB){print STDERR "\n|$stmtA|\n";} if (!$T) { $affected_rows = $dbhA->do($stmtA);} if (!$Q) {print " - cid_channels_recent_$PADserver_ip[$aas] flush: $affected_rows rows\n";} + + $stmtA = "OPTIMIZE table cid_channels_recent_$PADserver_ip[$aas];"; + if($DB){print STDERR "\n|$stmtA|\n";} + if (!$T) + { + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + @aryA = $sthA->fetchrow_array; + if (!$Q) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";} + $sthA->finish(); + } + if (!$Q) {print " - OPTIMIZE cid_channels_recent_$PADserver_ip[$aas] \n";} } $aas++; }