Skip to content

Conversation

@0xB10C
Copy link
Owner

@0xB10C 0xB10C commented Jan 14, 2026

Since #113, we are running into UNIQUE CONSTRAINT conflicts on each stats_version updated. Previously, we'd fall back to upserting each height in each table separatly. This had a few problems:

  1. It's slower than just deleting and inserting the stats for that height.
  2. It's more code and logic to maintain.
  3. And most importantly, there seems to be a memory leak when doing so. It just wasn't discovered before, as these manual upserts were rare.

Using SQLite's REPLACE (i.e. INSERT OR REPLACE) is an improvement on all of the above points.

fixes #117

Since #113, we are running into UNIQUE CONSTRAINT conflicts on each
stats_version updated. Previously, we'd fall back to upserting each
height in each table separatly. This had a few problems:

1. It's slower than just deleting and inserting the stats for that
   height.
2. It's more code and logic to maintain.
3. And most importantly, there seems to be a memory leak when doing
   so. It just wasn't discovered before, as these manual upserts
   were rare.

Using SQLite's REPLACE (i.e. INSERT OR REPLACE) is an improvement on
all of the above points.
@0xB10C 0xB10C merged commit f96790b into master Jan 14, 2026
8 checks passed
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.

Memory leak during full stats generation

2 participants