perf: order admin logs by created_at to use composite index (#5116)

This commit is contained in:
skynono
2026-05-30 20:00:02 +08:00
committed by GitHub
parent afb470e405
commit 230a3592f8
+1 -1
View File
@@ -354,7 +354,7 @@ func GetAllLogs(logType int, startTimestamp int64, endTimestamp int64, modelName
if err != nil {
return nil, 0, err
}
err = tx.Order("logs.id desc").Limit(num).Offset(startIdx).Find(&logs).Error
err = tx.Order("logs.created_at desc, logs.id desc").Limit(num).Offset(startIdx).Find(&logs).Error
if err != nil {
return nil, 0, err
}