Skip to content

Improve SQL store indices and queries - #2364

Open
gabrielbosio wants to merge 25 commits into
nextfrom
sql_store_indices_and_queries
Open

Improve SQL store indices and queries#2364
gabrielbosio wants to merge 25 commits into
nextfrom
sql_store_indices_and_queries

Conversation

@gabrielbosio

@gabrielbosio gabrielbosio commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator
  • Fixes get_unspent_input_note_nullifiers so that it doesn't take into account invalid notes as unspent notes.
  • Changes INSERT OR REPLACE queries to INSERT INTO ... ON CONFLICT UPDATE
  • Changes has_client_notes=true/false to has_client_notes=1/0. For the true case, it enforces index usage besides keeping consistency.
  • Adds consumer_account_id as the first column of the idx_input_notes_consumption.
    • This made get_input_note_by_offset grow quadratic instead of superlinear so the PR also replaces get_input_note_by_offset with get_input_note_after to avoid using OFFSETs in the SQL store query and instead pass the WHERE values that define the note order the user wants as argument.
  • Adds make bench-store to benchmark account/inputs scaling.
  • Fixes note-id tie-break on NoteFilter::Consumed query.
  • Adds InputNoteReader test coverage

This PR along one that adds query-plan regression tests would close #2348.

@gabrielbosio
gabrielbosio force-pushed the sql_store_indices_and_queries branch from 6319c1f to ecb7b03 Compare August 10, 2026 15:51
@juan518munoz
juan518munoz marked this pull request as ready for review August 18, 2026 15:30

@SantiagoPittella SantiagoPittella left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we could use a CLI test for the new command too

@igamigo
igamigo requested a review from TomasArrachea August 19, 2026 20:09
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.

SQL store hardening - Indexes and queries

3 participants