perf: add partial index for expired cache resource cleanup (#8728)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-04-05 14:33:03 -04:00
committed by GitHub
parent 7eaaf3021a
commit c721fac466
2 changed files with 6 additions and 0 deletions

View File

@@ -0,0 +1 @@
DROP INDEX IF EXISTS idx_resource_cache_expire;

View File

@@ -0,0 +1,5 @@
-- Partial functional index to speed up periodic cleanup of expired cache resources.
-- Matches the query: DELETE FROM resource WHERE resource_type = 'cache' AND to_timestamp((value->>'expire')::int) < now()
CREATE INDEX IF NOT EXISTS idx_resource_cache_expire
ON resource (to_timestamp((value->>'expire')::int))
WHERE resource_type = 'cache';