feat(compare): 比价记录列表增加分页 #156
Reference in New Issue
Block a user
Delete Branch "feat-recordpage"
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?
GET /api/v1/compare/records 新增 ordered / keyword 两个查询参数,过滤全部下推到 SQL。
不能分页之后再由客户端 filter —— 一页里可能一条都不命中,列表看着就是空的,
得翻很多页才蹦出一条。
顺带修掉这条链路上几处随数据量线性变慢的地方:
出参 ComparisonRecordOut 根本不读,却是每页几百 KB~几 MB 的白读 + 白反序列化,
是「比价记录/全部记录」页慢的主要来源;详情接口不 defer,raw_payload 照常返回。
店名捞进内存跟 50 条记录取交集。
ORDER BY created_at DESC, id DESC,PG 免排序直接取前 n 条。
迁移走 CREATE INDEX CONCURRENTLY,不阻塞线上 harvest 写入。
字段名和中文店名高度重复的 JSON 压缩比稳定 8~10 倍。
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com