Speed up access token cleanup with an index

This commit is contained in:
Quentin Gliech
2026-01-08 19:01:28 +01:00
parent fa742bc992
commit bf2ad55b5c

View File

@@ -0,0 +1,9 @@
-- no-transaction
-- Copyright 2026 Element Creations Ltd.
--
-- SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
-- Please see LICENSE in the repository root for full details.
-- This adds an index on the revoked_at field on oauth2_access_tokens to speed up cleaning them up
CREATE INDEX CONCURRENTLY IF NOT EXISTS oauth_access_tokens_revoked_at_idx
ON oauth2_access_tokens (revoked_at) WHERE revoked_at IS NOT NULL;