CodeChain-io / CodeChain-io/codechain-indexer

Remove O(m) DB queries

オープン
#316 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
21
フォーク
15
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。