Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexer: cp sequence number for tx indices query perf #16617

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

gegaowp
Copy link
Contributor

@gegaowp gegaowp commented Mar 12, 2024

Description

title
also merged the schema files of tx indices for simplicity

Test Plan

local cargo run to make sure that the column can be populated properly


If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

Copy link

vercel bot commented Mar 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 4:36pm
multisig-toolkit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 4:36pm
mysten-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 4:36pm
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 4:36pm
sui-kiosk ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 4:36pm
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2024 4:36pm

@gegaowp gegaowp merged commit 75afd6c into MystenLabs:main Mar 12, 2024
41 checks passed
tx_sequence_number BIGINT NOT NULL,
-- Object ID in bytes.
object_id BYTEA NOT NULL,
PRIMARY KEY(object_id, tx_sequence_number, cp_sequence_number)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: how come some of these tx_ tables have an index, and others don't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those indices were added for tx_reader, others count on the primary key.

sender BYTEA NOT NULL,
PRIMARY KEY(sender, tx_sequence_number, cp_sequence_number)
);
CREATE INDEX tx_senders_tx_sequence_number_index ON tx_senders (tx_sequence_number ASC, cp_sequence_number ASC);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when issuing a query, will we need to include order by cp_sequence_number asc or desc in order to leverage this index on scan or scan backward?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this index can be used for both forward and backward scans.
https://www.postgresql.org/docs/current/indexes-ordering.html

The index can also be scanned backward ...

in fact, it's a bit verbose here to specify ASC as it's the default one, I will remove it in a following PR I am working on

gegaowp added a commit to gegaowp/sui that referenced this pull request Mar 22, 2024
gegaowp added a commit that referenced this pull request Mar 22, 2024
gegaowp added a commit to gegaowp/sui that referenced this pull request Mar 22, 2024
gegaowp added a commit that referenced this pull request Mar 22, 2024
gegaowp added a commit to gegaowp/sui that referenced this pull request Mar 25, 2024
gegaowp added a commit that referenced this pull request Mar 25, 2024
…" (#16816)

This reverts commit 75afd6c.

## Description 

This is an indexer breaking change and as a result should not be merged
just yet before the corresponding backfill is done.

## Test Plan 

test on benchmark to make sure that after this revert, the schema is
compatible with one before.

## Prevention Plan

next time for breaking change, I will add `[NO COMMIT] indexer breaking
change` as the prefix.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
emmazzz pushed a commit that referenced this pull request Mar 27, 2024
leecchh pushed a commit that referenced this pull request Mar 27, 2024
…" (#16816)

This reverts commit 75afd6c.

## Description 

This is an indexer breaking change and as a result should not be merged
just yet before the corresponding backfill is done.

## Test Plan 

test on benchmark to make sure that after this revert, the schema is
compatible with one before.

## Prevention Plan

next time for breaking change, I will add `[NO COMMIT] indexer breaking
change` as the prefix.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
gegaowp added a commit to gegaowp/sui that referenced this pull request Apr 17, 2024
gegaowp added a commit to gegaowp/sui that referenced this pull request Apr 19, 2024
gegaowp added a commit to gegaowp/sui that referenced this pull request May 1, 2024
gegaowp added a commit that referenced this pull request May 2, 2024
amnn pushed a commit that referenced this pull request May 9, 2024
tx-tomcat pushed a commit to tx-tomcat/sui-network that referenced this pull request May 30, 2024
## Description 

title
also merged the schema files of tx indices for simplicity

## Test Plan 

local cargo run to make sure that the column can be populated properly

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants