查询指标数据时增加索引

This commit is contained in:
刘祥超
2021-08-30 15:23:51 +08:00
parent 674574a6af
commit f654c65626
2 changed files with 9 additions and 2 deletions

View File

@@ -197,6 +197,7 @@ func (this *MetricStatDAO) FindItemStatsWithClusterIdAndLastTime(tx *dbs.Tx, clu
var lastTime = lastStat.Time
var query = this.Query(tx).
UseIndex("cluster_item_time").
Attr("clusterId", clusterId).
Attr("itemId", itemId).
Attr("version", version).
@@ -243,6 +244,7 @@ func (this *MetricStatDAO) FindItemStatsWithNodeIdAndLastTime(tx *dbs.Tx, nodeId
var lastStat = statOne.(*MetricStat)
var lastTime = lastStat.Time
var query = this.Query(tx).
UseIndex("node_item_time").
Attr("nodeId", nodeId).
Attr("itemId", itemId).
Attr("version", version).
@@ -290,6 +292,7 @@ func (this *MetricStatDAO) FindItemStatsWithServerIdAndLastTime(tx *dbs.Tx, serv
var lastTime = lastStat.Time
var query = this.Query(tx).
UseIndex("server_item_time").
Attr("serverId", serverId).
Attr("itemId", itemId).
Attr("version", version).