Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const TOP_QUERIES_COLUMNS_IDS = {
UserSID: 'UserSID',
OneLineQueryText: 'OneLineQueryText',
QueryHash: 'QueryHash',
Duration: 'Duration',
};

const cpuTimeUsColumn: Column<KeyValueRow> = {
Expand Down Expand Up @@ -86,11 +87,20 @@ const queryHashColumn: Column<KeyValueRow> = {
sortable: false,
};

const durationColumn: Column<KeyValueRow> = {
name: TOP_QUERIES_COLUMNS_IDS.Duration,
header: 'Duration, ms',
render: ({row}) => formatNumber(row.Duration),
sortAccessor: (row) => Number(row.Duration),
align: DataTable.RIGHT,
};

export const getTopQueriesColumns = (): Column<KeyValueRow>[] => {
return [
cpuTimeUsColumn,
queryTextColumn,
endTimeColumn,
durationColumn,
readRowsColumn,
readBytesColumn,
userSIDColumn,
Expand Down
3 changes: 2 additions & 1 deletion src/store/reducers/executeTopQueries/executeTopQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ SELECT
EndTime,
ReadRows,
ReadBytes,
UserSID
UserSID,
Duration
FROM \`${path}/.sys/top_queries_by_cpu_time_one_hour\`
WHERE ${filterConditions || 'true'}
`;
Expand Down
1 change: 1 addition & 0 deletions src/utils/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const TOP_QUERIES_SORT_VALUES = {
ReadRows: 'ReadRows',
ReadBytes: 'ReadBytes',
UserSID: 'UserSID',
Duration: 'Duration',
} as const;

type TopShardsSortValue = ValueOf<typeof TOP_SHARDS_SORT_VALUES>;
Expand Down