mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-03 15:00:27 +08:00
优化指标数据清理
This commit is contained in:
@@ -481,6 +481,7 @@ func (this *MetricStatDAO) Clean(tx *dbs.Tx) error {
|
||||
_, err := this.Query(tx).
|
||||
Attr("itemId", item.Id).
|
||||
Lte("createdDay", expiresDay).
|
||||
UseIndex("createdDay").
|
||||
Limit(100_000). // 一次性不要删除太多,防止阻塞其他操作
|
||||
Delete()
|
||||
if err != nil {
|
||||
|
||||
@@ -188,6 +188,7 @@ func (this *MetricSumStatDAO) Clean(tx *dbs.Tx) error {
|
||||
Attr("itemId", item.Id).
|
||||
Where("(createdDay IS NULL OR createdDay<:day)").
|
||||
Param("day", expiresDay).
|
||||
UseIndex("createdDay").
|
||||
Limit(100_000). // 一次性不要删除太多,防止阻塞其他操作
|
||||
Delete()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user