Skip to content

Commit

Permalink
[indexer-alt] Update obj_version indexes (#20869)
Browse files Browse the repository at this point in the history
## Description 

Adds a new index to support bounded query.
I plan to merge this before I nuke the DB and start the race.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] gRPC:
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
lxfind authored Jan 21, 2025
1 parent c29efa3 commit 8f65342
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ CREATE TABLE IF NOT EXISTS obj_versions

CREATE INDEX IF NOT EXISTS obj_versions_cp_sequence_number
ON obj_versions (cp_sequence_number);

-- This index is primarily used for querying the latest version of an object bounded by
-- a view checkpoint number. Since a checkpoint can contain multiple versions of the
-- same object, we need to sort by cp_sequence_number DESC and object_version DESC to
-- get the latest version.
CREATE INDEX IF NOT EXISTS obj_versions_id_cp_version
ON obj_versions (object_id, cp_sequence_number DESC, object_version DESC)

0 comments on commit 8f65342

Please sign in to comment.