perf(mysql): batch adjacent DML into multi-statement COM_QUERY for large scripts

This commit is contained in:
zipg authored and GitHub committed 2026-08-11 13:06:21 +08:00
1 parent adb2b4c84b
commit 7c1d094946
9 files changed
+683 -82

No files matched your search

+5 -1
View File
@@ -368,8 +368,12 @@ export interface ExecutionSummaryItem {
export function executionSummaryItems(tab: Pick<QueryTab, "result" | "results" | "batchSqlExecution">): ExecutionSummaryItem[] {
const results = tab.results?.length ? tab.results : tab.result ? [tab.result] : [];
if (tab.batchSqlExecution?.items.length) {
const resultsByStatementIndex = new Map<number, QueryResult>();
results.forEach((result, resultIndex) => {
resultsByStatementIndex.set(result.statement_index ?? resultIndex, result);
});
return tab.batchSqlExecution.items.map((item, index) => {
const result = results.find((candidate, resultIndex) => (candidate.statement_index ?? resultIndex) === item.statementIndex);
const result = resultsByStatementIndex.get(item.statementIndex);
const returnedRows = result?.rows.length ?? 0;
const affectedRows = item.affectedRows ?? result?.affected_rows ?? 0;
const hasTabularResult = (result?.columns.length ?? 0) > 0;