commit 9f5286a2efcfbcbd44941b518af224992900fd2c parent eaa48160b91b4b6146b3549435f11d06383d960d Author: Christian Grothoff <christian@grothoff.org> Date: Wed, 29 Jul 2026 13:08:13 +0200 stasis: index challenge codes by expiration_date for garbage collection Diffstat:
| M | src/stasis/stasis-0001.sql | | | 5 | ++++- |
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/stasis/stasis-0001.sql b/src/stasis/stasis-0001.sql @@ -197,9 +197,12 @@ CREATE INDEX IF NOT EXISTS anastasis_challengecode_uuid_index COMMENT ON INDEX anastasis_challengecode_uuid_index IS 'for challenge lookup'; +-- GC deletes WHERE expiration_date < $1 with no truth_uuid predicate, so the +-- index must lead with expiration_date (a (truth_uuid, expiration_date) index +-- cannot serve it, and duplicating the lookup index above is pure overhead). CREATE INDEX IF NOT EXISTS anastasis_challengecode_expiration_index ON anastasis_challengecode - (truth_uuid,expiration_date); + (expiration_date); COMMENT ON INDEX anastasis_challengecode_expiration_index IS 'for challenge garbage collection';