diff --git a/.changeset/sixty-mangos-join.md b/.changeset/sixty-mangos-join.md new file mode 100644 index 000000000..ab361b42e --- /dev/null +++ b/.changeset/sixty-mangos-join.md @@ -0,0 +1,5 @@ +--- +"@hyperdx/app": patch +--- + +Improve memory efficiency in high row cound envs diff --git a/packages/app/src/components/DBRowTable.tsx b/packages/app/src/components/DBRowTable.tsx index d2306034e..d29dd8b66 100644 --- a/packages/app/src/components/DBRowTable.tsx +++ b/packages/app/src/components/DBRowTable.tsx @@ -10,6 +10,7 @@ import cx from 'classnames'; import { format, formatDistance } from 'date-fns'; import { isString } from 'lodash'; import curry from 'lodash/curry'; +import ms from 'ms'; import { useHotkeys } from 'react-hotkeys-hook'; import { Bar, @@ -1268,11 +1269,18 @@ function DBSqlRowTableComponent({ queryKey: [ 'denoised-rows', config, - processedRows, + denoiseResults, + // Only include processed rows if denoising is enabled + // This helps prevent the queryKey from getting extremely large + // and causing memory issues, when it's not used. + ...(denoiseResults ? [processedRows] : []), noisyPatternIds, patternColumn, ], queryFn: async () => { + if (!denoiseResults) { + return []; + } // No noisy patterns, so no need to denoise if (noisyPatternIds.length === 0) { return processedRows; @@ -1296,6 +1304,7 @@ function DBSqlRowTableComponent({ } return undefined; }, + gcTime: isLive ? ms('30s') : ms('5m'), // more aggressive gc for live data, since it can end up holding lots of data enabled: denoiseResults && noisyPatterns.isSuccess &&