Skip to content

Conversation

petertonysmith94
Copy link

Summary

  • Migrating away from using the cursor field for ordering + pagination
Understanding of the pagination
block_height

       0001
       0002   <---
       0003
       0004

WHERE
 (block_height > 0002)

---

block_height    transaction_index

       0001                    0
       0001                    1   <---
       0001                    2
       0001                    3


WHERE
 (block_height = 0001 AND transaction_index > 1) OR
 (block_height > 0001)

---

block_height    transaction_index     receipt_index

       0001                    0                 0
       0001                    0                 1     <---
       0001                    0                 2     
       0001                    1                 0
       0001                    2                 0
       0001                    3                 0


WHERE (
 (block_height = 0001 AND transaction_index = 0 AND receipt_index > 1) OR
 (block_height = 0001 AND transaction_index > 0) OR
 (block_height > 0001)
)

@petertonysmith94 petertonysmith94 self-assigned this Jul 10, 2025
query_builder: &mut QueryBuilder<Postgres>,
pagination: &QueryPagination,
cursor_field: &str,
join_prefix: Option<&str>,
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove the prefix here? I believe some places use it to create pagination over join query. Like predicates endpoint

Copy link
Author

Choose a reason for hiding this comment

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

I had mitigated this by putting the join_prefix within the cursor_fields like this.

However, I believe it's better to have for consistency (63ec002)

@petertonysmith94 petertonysmith94 force-pushed the ps/chore/migrate-away-from-cursor branch from bf6de28 to 5d396c5 Compare July 14, 2025 07:54
@petertonysmith94 petertonysmith94 force-pushed the ps/chore/migrate-away-from-cursor branch from 63ec002 to fb4d018 Compare July 14, 2025 08:31
@petertonysmith94
Copy link
Author

@luizstacio do we want to merge this one?

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.

2 participants