diff --git a/crates/sui-indexer-alt/migrations/2024-10-30-232206_wal_coin_balances/up.sql b/crates/sui-indexer-alt/migrations/2024-10-30-232206_wal_coin_balances/up.sql index 31bd0e82c1326e..9a78eeea9303b3 100644 --- a/crates/sui-indexer-alt/migrations/2024-10-30-232206_wal_coin_balances/up.sql +++ b/crates/sui-indexer-alt/migrations/2024-10-30-232206_wal_coin_balances/up.sql @@ -15,6 +15,17 @@ -- - There is an additional index on ID and version for querying the latest -- version of every object. -- +-- This table is used in conjunction with `sum_coin_balances` to support +-- consistent live object set queries: `sum_coin_balances` holds the state of +-- the live object set at some checkpoint `C < T` where `T` is the tip of the +-- chain, and `wal_coin_balances` stores all the updates and deletes between +-- `C` and `T`. +-- +-- To reconstruct the the live object set at some snapshot checkpoint `S` +-- between `C` and `T`, a query can be constructed that starts with the set +-- from `sum_coin_balances` and adds updates in `wal_coin_balances` from +-- `cp_sequence_number <= S`. +-- -- See `up.sql` for the original `sum_coin_balances` table for documentation on -- columns. CREATE TABLE IF NOT EXISTS wal_coin_balances