faraday/db
bitromortac c1ada7a4a3 db+chanevents: change to paginated GetChannelEvents
Switches the GetChannelEvents query from a timestamp-ordered scan to an
id-keyset cursor (WHERE id > $cursor ORDER BY id ASC LIMIT $n). The
keyset cursor is stable under concurrent inserts and survives a future
retention job that prunes the oldest rows: a positional OFFSET would
silently skip events whenever rows below the cursor are deleted, while
"id > $cursor" keeps advancing past whatever the caller has already
seen. The id field is documented in the proto as a server-assigned
monotonic identity, so callers persist last_id as their sync watermark.

Adds a (channel_id, id) composite index to back the new query; the
existing (channel_id, timestamp) index does not cover it and would
force a per-channel filter after a global id scan.
2026-05-08 20:13:58 +02:00
..
sqlc db+chanevents: change to paginated GetChannelEvents 2026-05-08 20:13:58 +02:00
interfaces.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
migrations.go db: add chanevents tables and queries 2026-04-01 15:06:37 +02:00
migrations_test.go db: add chanevents tables and queries 2026-04-01 15:06:37 +02:00
postgres.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
schemas.go db: add chanevents tables and queries 2026-04-01 15:06:37 +02:00
sql_migrations.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
sqlite.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00