- 新增 watched_at 索引,默认倒序翻页走 Merge Append 而不是全表排序 - 装配只取展示所需列,会话查询不再拉 refresh_token_hash - 关键词预检索加 2000 条上限 - admin-api 的 LocalDateTime 统一输出 yyyy-MM-dd HH:mm:ss
12 lines
490 B
PL/PgSQL
12 lines
490 B
PL/PgSQL
-- Author: fruit.com.cn
|
|
-- K112 观看记录默认列表的排序索引。
|
|
-- 后台按 watched_at DESC, id DESC 倒序翻页,原有索引都以 user_id/drama_id/device_id 开头,
|
|
-- 不带筛选条件时只能全表扫描再排序;补一条时间索引让翻页直接走索引。
|
|
-- watch_history 是分区表,在父表建索引会自动下发到各分区。
|
|
BEGIN;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_watch_history_watched_at
|
|
ON watch_history (watched_at DESC, id DESC);
|
|
|
|
COMMIT;
|