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

fix: keep block transfer index for faster transfers per block #260

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

rafaelcr
Copy link
Collaborator

@rafaelcr rafaelcr commented Nov 2, 2023

Avoid using LIMIT and OFFSET by keeping a transfer index per each location per block. This allows us to use a WHERE condition to filter the page, which will be very performant in super large blocks.

Also avoid the COUNT(*) OVER() by calculating the total using this cached column.

@rafaelcr rafaelcr temporarily deployed to Preview November 2, 2023 04:50 — with GitHub Actions Inactive
Copy link

github-actions bot commented Nov 2, 2023

Vercel deployment URL: https://ordinals-k1sduu5ea-blockstack.vercel.app 🚀

Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Merging #260 (eb1799d) into beta (18cd028) will increase coverage by 0.01%.
Report is 1 commits behind head on beta.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             beta     #260      +/-   ##
==========================================
+ Coverage   95.23%   95.25%   +0.01%     
==========================================
  Files          59       60       +1     
  Lines        6151     6176      +25     
  Branches      548      552       +4     
==========================================
+ Hits         5858     5883      +25     
  Misses        289      289              
  Partials        4        4              
Files Coverage Δ
...grations/1698897577725_locations-location-index.ts 100.00% <100.00%> (ø)
src/pg/pg-store.ts 97.68% <100.00%> (+0.02%) ⬆️
src/pg/types.ts 100.00% <100.00%> (ø)

@rafaelcr rafaelcr merged commit 0e33a64 into beta Nov 2, 2023
7 checks passed
@rafaelcr rafaelcr deleted the fix/block-transfers branch November 2, 2023 05:02
blockstack-devops pushed a commit that referenced this pull request Nov 2, 2023
## [2.0.0-beta.3](v2.0.0-beta.2...v2.0.0-beta.3) (2023-11-02)

### Bug Fixes

* keep block transfer index ([#260](#260)) ([0e33a64](0e33a64))
@blockstack-devops
Copy link

🎉 This PR is included in version 2.0.0-beta.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

blockstack-devops pushed a commit that referenced this pull request Nov 21, 2023
## [2.0.0](v1.2.6...v2.0.0) (2023-11-21)

### ⚠ BREAKING CHANGES

* handle transfer types and consider them for BRC-20 indexing (#258)

### Features

* handle transfer types and consider them for BRC-20 indexing ([#258](#258)) ([7b83761](7b83761))

### Bug Fixes

* address location counts ([#273](#273)) ([86efc3a](86efc3a))
* also remove null bytes in blessed inscriptions ([7e8d412](7e8d412))
* batch size to 2000 ([9cf9230](9cf9230))
* bump docker image ([08688da](08688da))
* do not reject unbounded inscriptions that come in disorder ([#264](#264)) ([56e2235](56e2235))
* guarantee gap detection is comparing numbers ([0f3f51a](0f3f51a))
* inscription count generation ([13e1f16](13e1f16))
* keep block transfer index ([#260](#260)) ([0e33a64](0e33a64))
* only advance blessed number after gap detection ([c8f3c81](c8f3c81))
* only scan BRC-20 after its genesis height ([#263](#263)) ([6381760](6381760))
* only validate gaps for blessed numbers ([#262](#262)) ([29aaeda](29aaeda))
* reduce batching to 4500 ([8fd770b](8fd770b))
* reduce brc-20 batch to 5k ([2037647](2037647))
* reduce brc20 processing batch size to half ([7079dc0](7079dc0))
* reduce chunk size to 3000 ([9556148](9556148))
* reduce to 4000 chunk size ([3373422](3373422))
* reject blocks that would create blessed inscription gaps ([#259](#259)) ([18cd028](18cd028))
* remove null bytes before inserting inscriptions ([#274](#274)) ([cec3de0](cec3de0))
* try batch iterator generator ([e2ed039](e2ed039))
* try returning brc20 batch to normal, use batchIterate everywhere ([1d3a24b](1d3a24b))
@blockstack-devops
Copy link

🎉 This PR is included in version 2.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

g0drlc added a commit to g0drlc/btc-ordinals-api that referenced this pull request Jul 14, 2024
g0drlc added a commit to g0drlc/btc-ordinals-api that referenced this pull request Jul 14, 2024
## [2.0.0](hirosystems/ordinals-api@v1.2.6...v2.0.0) (2023-11-21)

### ⚠ BREAKING CHANGES

* handle transfer types and consider them for BRC-20 indexing (#258)

### Features

* handle transfer types and consider them for BRC-20 indexing ([#258](hirosystems/ordinals-api#258)) ([7b83761](hirosystems/ordinals-api@7b83761))

### Bug Fixes

* address location counts ([#273](hirosystems/ordinals-api#273)) ([86efc3a](hirosystems/ordinals-api@86efc3a))
* also remove null bytes in blessed inscriptions ([7e8d412](hirosystems/ordinals-api@7e8d412))
* batch size to 2000 ([9cf9230](hirosystems/ordinals-api@9cf9230))
* bump docker image ([08688da](hirosystems/ordinals-api@08688da))
* do not reject unbounded inscriptions that come in disorder ([#264](hirosystems/ordinals-api#264)) ([56e2235](hirosystems/ordinals-api@56e2235))
* guarantee gap detection is comparing numbers ([0f3f51a](hirosystems/ordinals-api@0f3f51a))
* inscription count generation ([13e1f16](hirosystems/ordinals-api@13e1f16))
* keep block transfer index ([#260](hirosystems/ordinals-api#260)) ([0e33a64](hirosystems/ordinals-api@0e33a64))
* only advance blessed number after gap detection ([c8f3c81](hirosystems/ordinals-api@c8f3c81))
* only scan BRC-20 after its genesis height ([#263](hirosystems/ordinals-api#263)) ([6381760](hirosystems/ordinals-api@6381760))
* only validate gaps for blessed numbers ([#262](hirosystems/ordinals-api#262)) ([29aaeda](hirosystems/ordinals-api@29aaeda))
* reduce batching to 4500 ([8fd770b](hirosystems/ordinals-api@8fd770b))
* reduce brc-20 batch to 5k ([2037647](hirosystems/ordinals-api@2037647))
* reduce brc20 processing batch size to half ([7079dc0](hirosystems/ordinals-api@7079dc0))
* reduce chunk size to 3000 ([9556148](hirosystems/ordinals-api@9556148))
* reduce to 4000 chunk size ([3373422](hirosystems/ordinals-api@3373422))
* reject blocks that would create blessed inscription gaps ([#259](hirosystems/ordinals-api#259)) ([18cd028](hirosystems/ordinals-api@18cd028))
* remove null bytes before inserting inscriptions ([#274](hirosystems/ordinals-api#274)) ([cec3de0](hirosystems/ordinals-api@cec3de0))
* try batch iterator generator ([e2ed039](hirosystems/ordinals-api@e2ed039))
* try returning brc20 batch to normal, use batchIterate everywhere ([1d3a24b](hirosystems/ordinals-api@1d3a24b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants