Skip to content

Commit

Permalink
indexer minor: more efficient total tx query (MystenLabs#19004)
Browse files Browse the repository at this point in the history
## Description 

title, per a related slack thread 

## Test plan 

CI

---

## 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): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
gegaowp authored Aug 15, 2024
1 parent 8a6959c commit fea5821
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/sui-indexer/src/store/pg_indexer_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,9 +1224,9 @@ impl<T: R2D2Connection + 'static> PgIndexerStore<T> {
read_only_blocking!(&self.blocking_cp, |conn| {
checkpoints::table
.filter(checkpoints::epoch.eq(epoch as i64))
.select(max(checkpoints::network_total_transactions))
.first::<Option<i64>>(conn)
.map(|o| o.unwrap_or(0))
.select(checkpoints::network_total_transactions)
.order_by(checkpoints::sequence_number.desc())
.first::<i64>(conn)
})
.context("Failed to get network total transactions in epoch")
.map(|v| v as u64)
Expand Down

0 comments on commit fea5821

Please sign in to comment.