Files
supabase/apps/studio/components/interfaces/QueryPerformance/QueryPerformance.constants.ts
kemal.earth 604be766a8 feat(studio): query performance metric cards (#38634)
* feat: remove tabs and unify columns

This removes the tabs from Query Performance with unified columns in the table.

* chore: remove unused imports

* chore: small adjustment to min max and mean time col size

* feat: original experiment with metric cards

* fix: height of table container on load

* feat: add percentage background for time consumed col

Adds a percentage based background colour for time consumed column and reshuffles some columns.

* feat: working metrics above rows

* feat: simplify stats + go back full width

* style: bring up percentage bar opacity

* chore: remove reportType again

* feat: add metric queries to reset function

* fix: type error for passing query metrics

* fix: query queries plural thing

* chore: remove next-env weirdness
2025-09-15 12:45:23 +01:00

26 lines
1.3 KiB
TypeScript

export enum QUERY_PERFORMANCE_REPORT_TYPES {
MOST_TIME_CONSUMING = 'most_time_consuming',
MOST_FREQUENT = 'most_frequent',
SLOWEST_EXECUTION = 'slowest_execution',
UNIFIED = 'unified',
}
export const QUERY_PERFORMANCE_PRESET_MAP = {
[QUERY_PERFORMANCE_REPORT_TYPES.MOST_TIME_CONSUMING]: 'mostTimeConsuming',
[QUERY_PERFORMANCE_REPORT_TYPES.MOST_FREQUENT]: 'mostFrequentlyInvoked',
[QUERY_PERFORMANCE_REPORT_TYPES.SLOWEST_EXECUTION]: 'slowestExecutionTime',
[QUERY_PERFORMANCE_REPORT_TYPES.UNIFIED]: 'unified',
} as const
export const QUERY_PERFORMANCE_COLUMNS = [
{ id: 'query', name: 'Query', description: undefined, minWidth: 500 },
{ id: 'prop_total_time', name: 'Time consumed', description: undefined, minWidth: 130 },
{ id: 'total_time', name: 'Total time', description: 'latency', minWidth: 150 },
{ id: 'calls', name: 'Calls', description: undefined, minWidth: 100 },
{ id: 'max_time', name: 'Max time', description: undefined, minWidth: 100 },
{ id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 100 },
{ id: 'min_time', name: 'Min time', description: undefined, minWidth: 100 },
{ id: 'avg_rows', name: 'Avg. Rows', description: undefined, minWidth: 100 },
{ id: 'rolname', name: 'Role', description: undefined, minWidth: 120 },
] as const