docs: explain deployment stages and separate comment sections [skip ci]

This commit is contained in:
2026-11-17 00:01:26 +08:00
parent 00fd89af1a
commit 53bc8d73eb
7 changed files with 123 additions and 0 deletions
+7
View File
@@ -4,15 +4,22 @@
-- transaction. Core's SELECT-only runtime role must never execute this file.
-- These indexes support the actual author search and exact category filter;
-- the migration already owns the title/abstract English GIN index.
-- 调整的是当前运维会话的等待/维护预算,不会修改运行时服务连接池的配置。
-- 数据库迁移器只扫描 db/,不会自动执行这个文件;必须由有权限的运维会话单独运行。
SET lock_timeout = '2s';
SET statement_timeout = '20min';
SET maintenance_work_mem = '32MB';
SET max_parallel_maintenance_workers = 0;
-- (tag_id,paper_id) 支持纯主题页直接走关联索引,在 LIMIT 前避免读所有宽论文行。
-- 先按 tag_id 找命中的 paper_id,适配按主题过滤的访问方向;不是对论文全文字段建立索引。
CREATE INDEX CONCURRENTLY IF NOT EXISTS paper_tags_tag_paper
ON research.paper_tags(tag_id,paper_id);
-- simple 配置匹配作者查询的表达式,不对姓名做 english 词干化;索引表达式须与查询一致。
-- GIN 索引支持作者全文检索,使用 simple 配置保留姓名词项;与查询表达式不同就不能假设会命中本索引。
CREATE INDEX CONCURRENTLY IF NOT EXISTS papers_authors_search_gin
ON research.papers USING gin(to_tsvector('simple'::regconfig,authors_json));
-- After an interrupted concurrent build, inspect pg_index.indisvalid before
-- reuse. IF NOT EXISTS alone does not repair an invalid index.