diff --git a/apps/studio/components/interfaces/QueryPerformance/QueryPerformance.constants.ts b/apps/studio/components/interfaces/QueryPerformance/QueryPerformance.constants.ts
index 35d69f4e347f6..6dc2007951dfb 100644
--- a/apps/studio/components/interfaces/QueryPerformance/QueryPerformance.constants.ts
+++ b/apps/studio/components/interfaces/QueryPerformance/QueryPerformance.constants.ts
@@ -12,31 +12,31 @@ export const QUERY_PERFORMANCE_PRESET_MAP = {
export const QUERY_PERFORMANCE_REPORTS = {
[QUERY_PERFORMANCE_REPORT_TYPES.MOST_TIME_CONSUMING]: [
- { id: 'query', name: 'Query', description: undefined, minWidth: 600 },
- { id: 'rolname', name: 'Role', description: undefined, minWidth: undefined },
- { id: 'calls', name: 'Calls', description: undefined, minWidth: 60 },
+ { id: 'query', name: 'Query', description: undefined, minWidth: 500 },
+ { id: 'calls', name: 'Calls', description: undefined, minWidth: 100 },
{ id: 'total_time', name: 'Total time', description: 'latency', minWidth: 150 },
- { id: 'prop_total_time', name: 'Time consumed', description: undefined, minWidth: 110 },
- { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 80 },
+ { id: 'prop_total_time', name: 'Time consumed', description: undefined, minWidth: 150 },
+ { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 150 },
+ { id: 'rolname', name: 'Role', description: undefined, minWidth: 120 },
],
[QUERY_PERFORMANCE_REPORT_TYPES.MOST_FREQUENT]: [
- { id: 'query', name: 'Query', description: undefined, minWidth: 600 },
- { id: 'rolname', name: 'Role', description: undefined, minWidth: undefined },
- { id: 'avg_rows', name: 'Avg. Rows', description: undefined, minWidth: undefined },
- { id: 'calls', name: 'Calls', description: undefined, minWidth: undefined },
- { id: 'max_time', name: 'Max time', description: undefined, minWidth: undefined },
- { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: undefined },
- { id: 'min_time', name: 'Min time', description: undefined, minWidth: undefined },
- { id: 'total_time', name: 'Total time', description: 'latency', minWidth: 180 },
+ { id: 'query', name: 'Query', description: undefined, minWidth: 500 },
+ { id: 'avg_rows', name: 'Avg. Rows', description: undefined, minWidth: 100 },
+ { id: 'calls', name: 'Calls', description: undefined, minWidth: 100 },
+ { id: 'total_time', name: 'Total time', description: 'latency', minWidth: 150 },
+ { id: 'max_time', name: 'Max time', description: undefined, minWidth: 150 },
+ { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 150 },
+ { id: 'min_time', name: 'Min time', description: undefined, minWidth: 150 },
+ { id: 'rolname', name: 'Role', description: undefined, minWidth: 120 },
],
[QUERY_PERFORMANCE_REPORT_TYPES.SLOWEST_EXECUTION]: [
- { id: 'query', name: 'Query', description: undefined, minWidth: 600 },
- { id: 'rolname', name: 'Role', description: undefined, minWidth: undefined },
- { id: 'avg_rows', name: 'Avg. Rows', description: undefined, minWidth: undefined },
- { id: 'calls', name: 'Calls', description: undefined, minWidth: undefined },
- { id: 'max_time', name: 'Max time', description: undefined, minWidth: undefined },
- { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: undefined },
- { id: 'min_time', name: 'Min time', description: undefined, minWidth: undefined },
- { id: 'total_time', name: 'Total time', description: 'latency', minWidth: 180 },
+ { id: 'query', name: 'Query', description: undefined, minWidth: 500 },
+ { id: 'avg_rows', name: 'Avg. Rows', description: undefined, minWidth: 100 },
+ { id: 'calls', name: 'Calls', description: undefined, minWidth: 100 },
+ { id: 'total_time', name: 'Total time', description: 'latency', minWidth: 150 },
+ { id: 'max_time', name: 'Max time', description: undefined, minWidth: 150 },
+ { id: 'mean_time', name: 'Mean time', description: undefined, minWidth: 150 },
+ { id: 'min_time', name: 'Min time', description: undefined, minWidth: 150 },
+ { id: 'rolname', name: 'Role', description: undefined, minWidth: 120 },
],
} as const
diff --git a/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceFilterBar.tsx b/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceFilterBar.tsx
index 1be556d2a3db9..0775f723264d5 100644
--- a/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceFilterBar.tsx
+++ b/apps/studio/components/interfaces/QueryPerformance/QueryPerformanceFilterBar.tsx
@@ -10,8 +10,9 @@ import { useDatabaseRolesQuery } from 'data/database-roles/database-roles-query'
import { DbQueryHook } from 'hooks/analytics/useDbQuery'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
-import { Button } from 'ui'
+import { Button, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
import { Input } from 'ui-patterns/DataInputs/Input'
+import { useQueryPerformanceSort } from './hooks/useQueryPerformanceSort'
export const QueryPerformanceFilterBar = ({
queryPerformanceQuery,
@@ -22,6 +23,7 @@ export const QueryPerformanceFilterBar = ({
}) => {
const { ref } = useParams()
const { data: project } = useSelectedProjectQuery()
+ const { sort, clearSort } = useQueryPerformanceSort()
const [showBottomSection] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.QUERY_PERF_SHOW_BOTTOM_SECTION,
true
@@ -63,7 +65,7 @@ export const QueryPerformanceFilterBar = ({
}, [searchValue])
return (
-
+
+
+ {sort && (
+
+
+ Sort: {sort.column} {sort.order}
+
+
+
+
+
+ Clear sort
+
+
+ )}
-
+
{!showBottomSection && onResetReportClick && (