mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-08 11:20:27 +08:00
优化本地数据库性能
This commit is contained in:
@@ -24,7 +24,11 @@ func init() {
|
||||
var stats = []string{}
|
||||
for _, stat := range SharedQueryStatManager.TopN(10) {
|
||||
var avg = stat.CostTotal / float64(stat.Calls)
|
||||
stats = append(stats, fmt.Sprintf("%.2fms/%.2fms/%.2fms - %d - %s", stat.CostMin*1000, stat.CostMax*1000, avg*1000, stat.Calls, stat.Query))
|
||||
var query = stat.Query
|
||||
if len(query) > 100 {
|
||||
query = query[:100]
|
||||
}
|
||||
stats = append(stats, fmt.Sprintf("%.2fms/%.2fms/%.2fms - %d - %s", stat.CostMin*1000, stat.CostMax*1000, avg*1000, stat.Calls, query))
|
||||
}
|
||||
logs.Println("====DB STATS====\n" + strings.Join(stats, "\n"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user