Skip to content

[trade-off] foreshadowings SQLite 索引建而未用 #26

Description

@ULookup

现状

ForeshadowingStore::initialize() 创建了 foreshadowings_by_statusforeshadowings_by_tag 索引。

list(), stats(), relevant_for_scene(), final_act_reminders() 全部走 directory_iterator 扫描 JSON 文件。SQLite 表只写不读。

当前取舍

  • 单一世界伏笔量预期不超过数百条,文件系统扫描性能充足
  • 索引开销接近零(写入时多维护一个 B-tree)
  • 作为未来平滑切换到 SQL 查询的预留

升级触发条件

当某个世界有上万条伏笔时,改查询方法用 SELECT id FROM foreshadowings WHERE world_id=? AND status='open' 过滤,无需改 API。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

trade-offIntentional design trade-off, deferred optimizationworldbuildingWorldbuilding novel agent feature

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions