Remove O(m) DB queries
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- api, databases, performance
调研方向
首先定位用于 Asset-type UTXO 查询、账户聚合、快照创建以及 web wallet 或 Hub 使用的 API 的 Indexer 入口点。检查这些查询当前如何扫描结果,并确定 API 和 consumer 需要进行哪些更改,以便分批获取结果且每批有明确上限;完成的标准是没有任何单个请求扫描全部 m 个 UTXO。
由索引模型根据 Issue 内容生成。
描述
When querying UTXOs using Asset type, aggregating UTXOs by account, and creating a snapshot, the Indexer scans all the UTXOs that have a specific account or a specific asset type.
When a user opens a CodeChain web wallet, wallet requests the total amount of assets that the user has to the Indexer. Indexer sends a query that scans all the UTXOs that the user has. If the number of UTXOs that the user has is m, the upper bound of the query is O(m).
How to solve
Make APIs return sub results that read k rows in the DB. The Web wallet or Hub should request the maximum [n/k] number of API calls to get all the results. The upper bound of each query is O(k*log m). Then there won't be a single slow query that consumes all the resources(CPU, Memory, disk I/O) in the DB.
- 主要语言
- TypeScript
- 星标
- 21
- 派生
- 15
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CodeChain-io/codechain-indexer 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 42/100
-
难度 2/5 1-3 小时 新手友好度 45/100
-
难度 1/5 1 小时以内 新手友好度 45/100
-
maintenance
难度 3/5 1-2 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 35/100
查看 CodeChain-io/codechain-indexer 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
vercel/streamdown#673 · 1 个 reaction ·
维护者通常 1 天内回复
-
docs(stream-protocol): document messageMetatadata on start/finish and the message-metadata chunk可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭factory-active task-identify-harness-labels-done task-identify-issue-type-done
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
agilepathway/label-checker#721 ·
维护者通常 1 天内回复
-
CLI Empathy needs triage
难度 2/5 1-3 小时 新手友好度 74/100
chromaui/chromatic-cli#1524 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复