refactor(daemon): optimize _signals prune SQL #178
Reference in New Issue
Block a user
Delete Branch "refactor/prune-sql-optimization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Optimize the _signals table prune query for better performance at large retention values.
Why
As noted in PR #177 review by @xiaomo, the NOT IN subquery scales poorly with large retention values. The OFFSET-based approach finds the cutoff id directly and deletes everything below it.
Changes
Ref
Follow-up from PR #177 review feedback
LGTM ✅ 一行精准优化,
LIMIT 1 OFFSET ?比NOT IN子查询少扫一遍表。