Skip to content
Closed
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
3 changes: 1 addition & 2 deletions apps/desktop/src/components/grid/DataGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ import {
parseFilterValues,
} from "@/lib/dataGrid/dataGridColumnFilter";
import { clampSearchSplitWidth } from "@/lib/dataGrid/dataGridSearchSplit";
import { MAX_RESULT_PAGE_SIZE, MIN_RESULT_PAGE_SIZE, normalizeResultPageSize, resultPageSizeMenuOptions } from "@/lib/dataGrid/paginationPageSize";
import { MIN_RESULT_PAGE_SIZE, normalizeResultPageSize, resultPageSizeMenuOptions } from "@/lib/dataGrid/paginationPageSize";
import { allNullColumnIndexes, filterColumnVisibilityOptions, hiddenColumnIndexesWithAllNullColumns, invertedHiddenColumnIndexes, nextHiddenColumnIndexes, removeAutoHiddenColumnIndexes, visibleColumnIndexesForFilter } from "@/lib/dataGrid/dataGridColumnVisibility";
import { buildDataGridColumnLookupItems, filterDataGridColumnLookupItems } from "@/lib/dataGrid/dataGridColumnLookup";
import { columnOrderKeysForIndexes, isDefaultColumnOrder, moveVisibleColumnIndex, orderedColumnIndexes, uniqueDataGridColumnOrderKeys } from "@/lib/dataGrid/dataGridColumnOrder";
Expand Down Expand Up @@ -11114,7 +11114,6 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
type="number"
inputmode="numeric"
:min="MIN_RESULT_PAGE_SIZE"
:max="MAX_RESULT_PAGE_SIZE"
class="h-6 w-20 px-1.5 text-xs tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
@keydown.enter.prevent.stop="applyCustomPageSize"
/>
Expand Down
5 changes: 2 additions & 3 deletions apps/desktop/src/lib/dataGrid/paginationPageSize.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
export const RESULT_PAGE_SIZE_OPTIONS = [50, 100, 500, 1000];
export const DEFAULT_RESULT_PAGE_SIZE = 100;
export const MIN_RESULT_PAGE_SIZE = 1;
export const MAX_RESULT_PAGE_SIZE = 100000;

export function normalizeResultPageSize(value: unknown, fallback = DEFAULT_RESULT_PAGE_SIZE): number {
const fallbackValue = Number.isFinite(fallback) && fallback >= MIN_RESULT_PAGE_SIZE ? Math.min(Math.floor(fallback), MAX_RESULT_PAGE_SIZE) : DEFAULT_RESULT_PAGE_SIZE;
const fallbackValue = Number.isFinite(fallback) && fallback >= MIN_RESULT_PAGE_SIZE ? Math.floor(fallback) : DEFAULT_RESULT_PAGE_SIZE;
const parsed = Number(value);
if (!Number.isFinite(parsed)) return fallbackValue;
const rounded = Math.floor(parsed);
if (rounded < MIN_RESULT_PAGE_SIZE) return fallbackValue;
return Math.min(rounded, MAX_RESULT_PAGE_SIZE);
return rounded;
}

export function resultPageSizeMenuOptions(current: number): number[] {
Expand Down
2 changes: 1 addition & 1 deletion docs/performance/memory-usage-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Chunk 体积不等于运行时内存,但能提示哪些功能首次打开会
3. 客户端搜索增加上限和渐进式扫描,例如只扫描当前页或前 N 行,超限提示用户改用 SQL 查询。
4. 导出改成 streaming writer,不返回包含全量 rows 的 `QueryResult`。CSV/Excel/JSON 都应边拉边写,避免 `rows.push(...)` 聚合。
5. 缓存落盘时避免 `structuredClone`、row-to-column、encode 同时叠加;可用分块序列化,或在清空原始引用后再进行后台转换。
6. 对 `MAX_RESULT_PAGE_SIZE` 做产品级收紧。当前最大可到 100,000 行,配合宽表和 DataGrid 派生数组会非常容易冲高内存
6. 取消分页条数 100000 硬性上限,支持全量查询场景;超大分页 + 宽表易引发内存暴涨,请按需合理使用

## 2. 数据对比 Data Compare

Expand Down
2 changes: 1 addition & 1 deletion packages/app-tests/settingsStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function withMockLocalStorage(initial: Record<string, string>, run: () =>
test("normalizes saved query result page size", () => {
assert.equal(DEFAULT_EDITOR_SETTINGS.pageSize, 100);
assert.equal(normalizeEditorSettings({ pageSize: 5000 }).pageSize, 5000);
assert.equal(normalizeEditorSettings({ pageSize: 200000 }).pageSize, 100000);
assert.equal(normalizeEditorSettings({ pageSize: 200000 }).pageSize, 200000);
assert.equal(normalizeEditorSettings({ pageSize: 0 }).pageSize, 100);
});

Expand Down
Loading