Skip to content

sql partial refresh support#8914

Open
rustyrussell wants to merge 9 commits intoElementsProject:masterfrom
rustyrussell:guilt/sql-partial-refresh
Open

sql partial refresh support#8914
rustyrussell wants to merge 9 commits intoElementsProject:masterfrom
rustyrussell:guilt/sql-partial-refresh

Conversation

@rustyrussell
Copy link
Contributor

Replaces #8841

This properly adds wait support to all supported tables (ie. all list commands which support indexing) in the sql plugin. It's a little tricky, so we do this in easy stages.

The final result is far more optimal for queries to those tables.

1. Refresh time would say "dont refresh if it's only this old" but
   better is to simply make refresh more efficient, which we've done
   and continue to do.
2. time_msec could be used in two places, but floating point suffices.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell added this to the v26.04 milestone Feb 25, 2026
This is trivial now, as the invoice table gets reloaded every time,
but is an important check as we improve the implementation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
It's a "have we initialized the table" flag, and we're going to use it for more
than setting up the indices, so rename it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We can actually just make struct table_desc non-const where required,
and hand its var directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We now always watch for deleted/created/updated, and keep multiple
flags and indices (though we don't use them yet!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We're going to need this once we start using `wait updated` to track
these.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The current variable name is confusing, since it's an INSERT!

This becomes more noticible in the next patch, where we add a delete statement.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ndex values.

This will let us (efficiently) delete a single entry, so we can wean
tables with created_index off the default "delete all and reload" behavior.

Change insert_stmt to a const, too (and use a temporary when we're
building it).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
For these, when things change, we simply delete amd recreate the
changed entries.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Plugins: `sql` plugin tables "htlcs", "forwards", "invoices", "sendpays" and "networkevents" are now updated more efficiently.
@rustyrussell rustyrussell force-pushed the guilt/sql-partial-refresh branch from faa785e to e3859eb Compare February 26, 2026 00:18
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.

1 participant