QueryPerformance.constants.ts90 lines · main
1export enum QUERY_PERFORMANCE_REPORT_TYPES {
2 MOST_TIME_CONSUMING = 'most_time_consuming',
3 MOST_FREQUENT = 'most_frequent',
4 SLOWEST_EXECUTION = 'slowest_execution',
5 UNIFIED = 'unified',
6}
7
8export const QUERY_PERFORMANCE_PRESET_MAP = {
9 [QUERY_PERFORMANCE_REPORT_TYPES.MOST_TIME_CONSUMING]: 'mostTimeConsuming',
10 [QUERY_PERFORMANCE_REPORT_TYPES.MOST_FREQUENT]: 'mostFrequentlyInvoked',
11 [QUERY_PERFORMANCE_REPORT_TYPES.SLOWEST_EXECUTION]: 'slowestExecutionTime',
12 [QUERY_PERFORMANCE_REPORT_TYPES.UNIFIED]: 'unified',
13} as const
14
15export const QUERY_PERFORMANCE_COLUMNS = [
16 { id: 'query', name: 'Query', description: undefined, minWidth: 450 },
17 { id: 'prop_total_time', name: 'Time consumed', description: undefined, minWidth: 150 },
18 { id: 'calls', name: 'Calls', description: undefined, minWidth: 100 },
19 { id: 'max_time', name: 'Max time', description: undefined, minWidth: 100 },
20 { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 100 },
21 { id: 'min_time', name: 'Min time', description: undefined, minWidth: 100 },
22 { id: 'rows_read', name: 'Rows processed', description: undefined, minWidth: 130 },
23 { id: 'cache_hit_rate', name: 'Cache hit rate', description: undefined, minWidth: 130 },
24 { id: 'rolname', name: 'Role', description: undefined, minWidth: 200 },
25 { id: 'application_name', name: 'Application', description: undefined, minWidth: 150 },
26] as const
27
28export const QUERY_PERFORMANCE_ROLE_DESCRIPTION = [
29 { name: 'postgres', description: 'The default Postgres role. This has admin privileges.' },
30 {
31 name: 'anon',
32 description:
33 'For unauthenticated, public access. This is the role which the API (PostgREST) will use when a user is not logged in.',
34 },
35 {
36 name: 'authenticator',
37 description:
38 'A special role for the API (PostgREST). It has very limited access, and is used to validate a JWT and then "change into" another role determined by the JWT verification.',
39 },
40 {
41 name: 'authenticated',
42 description:
43 'For "authenticated access." This is the role which the API (PostgREST) will use when a user is logged in.',
44 },
45 {
46 name: 'service_role',
47 description:
48 'For elevated access. This role is used by the API (PostgREST) to bypass Row Level Security.',
49 },
50 {
51 name: 'briven_auth_admin',
52 description:
53 'Used by the Auth middleware to connect to the database and run migration. Access is scoped to the auth schema.',
54 },
55 {
56 name: 'briven_storage_admin',
57 description:
58 'Used by the Auth middleware to connect to the database and run migration. Access is scoped to the storage schema.',
59 },
60 { name: 'dashboard_user', description: 'For running commands via the Briven UI.' },
61 {
62 name: 'briven_admin',
63 description:
64 'An internal role Briven uses for administrative tasks, such as running upgrades and automations.',
65 },
66 {
67 name: 'pgbouncer',
68 description:
69 'PgBouncer is a lightweight connection pooler for PostgreSQL. Available on paid plans only.',
70 },
71] as const
72
73export const QUERY_PERFORMANCE_CHART_TABS = [
74 {
75 id: 'query_latency',
76 label: 'Query latency',
77 },
78 {
79 id: 'rows_read',
80 label: 'Rows read',
81 },
82 {
83 id: 'calls',
84 label: 'Calls',
85 },
86 {
87 id: 'cache_hits',
88 label: 'Cache hits',
89 },
90]