Zach Hirschtritt 8cb1d24b36
fix: add user id index on sessions8 (#9834)
# Which Problems Are Solved

When a user changes their password, Zitadel needs to terminate all of
that user's active sessions. This query can take many seconds on
deployments with large session and user tables. This happens as part of
session projection handling, so doesn't directly impact user experience,
but potentially bogs down the projection handler which isn't great. In
the future, this index could be used to power a "see all of my current
sessions" feature in Zitadel.

# How the Problems Are Solved

Adds new index on `user_id` column on `projections.sessions8` table.
Alternatively, we can index on `(instance_id, user_id)` instead but
opted for keeping the index smaller as we already index on `instance_id`
separately.

# Additional Changes

None

# Additional Context

None

---------

Co-authored-by: Silvan <27845747+adlerhurst@users.noreply.github.com>
2025-05-06 06:38:19 +00:00
..
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-03-31 12:45:11 +02:00
2024-02-28 10:55:54 +02:00
2024-04-16 11:19:17 +00:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00
2025-04-02 16:53:06 +02:00