Files
supabase/apps/studio/data/auth/keys.ts
T
CharisandJoshen Lim 271ee3af6d fix: estimate number of users when count is large (#38638)
* fix: estimate number of users when count is large

In the Auth Users table, we always fetch an exact count of users. This
can be a problem for projects with many (>50K) users as the count(*)
might cause performance issues on the database. We already have logic on
the Table Editor to only run automatic count estimates (fetching the
exact count only if usr requests it), this change ports the same logic
over to Auth Users.

* Nit refactor

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-09-12 13:07:31 +08:00

41 lines
1.1 KiB
TypeScript

export const authKeys = {
users: (
projectRef: string | undefined,
params?: {
page: number | undefined
keywords: string | undefined
filter: string | undefined
}
) => ['projects', projectRef, 'users', ...(params ? [params] : [])] as const,
usersInfinite: (
projectRef: string | undefined,
params?: {
keywords: string | undefined
filter: string | undefined
providers: string[] | undefined
sort: string | undefined
order: string | undefined
}
) =>
[
'projects',
projectRef,
'users-infinite',
...(params ? [params].filter(Boolean) : []),
] as const,
usersCount: (
projectRef: string | undefined,
params?: {
keywords: string | undefined
filter: string | undefined
providers: string[] | undefined
forceExactCount?: boolean
}
) =>
['projects', projectRef, 'users-count', ...(params ? [params].filter(Boolean) : [])] as const,
authConfig: (projectRef: string | undefined) => ['projects', projectRef, 'auth-config'] as const,
accessToken: () => ['access-token'] as const,
}