Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: display query elapsed time (#6810)

Liu Ji6f31c7042acd
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index c571c2c437..f4524c3b47 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1753,7 +1753,8 @@
},
"allow-admin-mode-only": "Instance {instance} is accessible in admin mode only.",
"run-selected": "Run selected",
- "clear-screen": "Clear screen"
+ "clear-screen": "Clear screen",
+ "query-time": "Query time"
},
"schema-editor": {
"self": "Schema Editor",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 09d586222d..d31dd70086 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -1739,7 +1739,8 @@
},
"allow-admin-mode-only": "La instancia {instance} solo es accesible en modo administrador.",
"run-selected": "Ejecutar selección",
- "clear-screen": "Limpiar pantalla"
+ "clear-screen": "Limpiar pantalla",
+ "query-time": "Tiempo de consulta"
},
"schema-editor": {
"self": "Editor de esquema",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 65a67d77dc..88842a54ff 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1748,7 +1748,8 @@
},
"allow-admin-mode-only": "实例{instance}只能通过管理员模式访问。",
"run-selected": "运行选中的语句",
- "clear-screen": "清屏"
+ "clear-screen": "清屏",
+ "query-time": "查询时间"
},
"schema-editor": {
"self": "Schema 编辑器",
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
index 696bf6f182..1c5dce0874 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue
@@ -1,7 +1,7 @@
<template>
<NConfigProvider
v-bind="naiveUIConfig"
- class="relative flex flex-col justify-start items-start p-2"
+ class="relative flex flex-col justify-start items-start p-2 pb-1"
:class="dark && 'dark bg-dark-bg'"
>
<template v-if="executeParams && resultSet && !showPlaceholder">
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index ec8c99d349..7b1db95228 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -75,6 +75,13 @@
:keyword="state.search"
/>
</div>
+
+ <div class="w-full flex items-center justify-between text-xs mt-0.5">
+ <div></div>
+ <div class="text-control-light">
+ {{ $t("sql-editor.query-time") }}: {{ queryTime }}
+ </div>
+ </div>
</template>
<template v-else-if="viewMode === 'AFFECTED-ROWS'">
<div
@@ -361,4 +368,17 @@ const explainFromSQLResultSetV1 = (resultSet: SQLResultSetV1 | undefined) => {
const explain = lines.map((line) => line[0]).join("\n");
return explain;
};
+
+const queryTime = computed(() => {
+ const { latency } = props.result;
+ if (!latency) return "-";
+
+ const { seconds, nanos } = latency;
+ const totalSeconds = seconds + nanos / 1e9;
+ if (totalSeconds < 1) {
+ const totalMS = Math.round(totalSeconds * 1000);
+ return `${totalMS} ms`;
+ }
+ return `${totalSeconds.toFixed(2)} s`;
+});
</script>