This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch fix/query-history-duration-display
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a26299377b8446b3d32aadea3b3eb20e0ead1b83
Author: Evan Rusackas <[email protected]>
AuthorDate: Fri Aug 1 14:20:04 2025 -0700

    fix(sqllab): show actual execution duration in Query History
    
    The duration column in SQL Lab's Query History was displaying the total 
time from query submission to completion, including queue/scheduling time. This 
fix makes it show only the actual execution duration by using 
start_running_time when available.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <[email protected]>
---
 superset-frontend/src/pages/QueryHistoryList/index.tsx | 15 +++++++++------
 superset-frontend/src/views/CRUD/types.ts              |  2 ++
 superset/queries/api.py                                |  1 +
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/superset-frontend/src/pages/QueryHistoryList/index.tsx 
b/superset-frontend/src/pages/QueryHistoryList/index.tsx
index 7f37e6dedc..c1b5404457 100644
--- a/superset-frontend/src/pages/QueryHistoryList/index.tsx
+++ b/superset-frontend/src/pages/QueryHistoryList/index.tsx
@@ -256,15 +256,18 @@ function QueryList({ addDangerToast }: QueryListProps) {
         size: 'xl',
         Cell: ({
           row: {
-            original: { status, start_time, end_time },
+            original: { status, start_time, start_running_time, end_time },
           },
         }: any) => {
           const timerType = status === QueryState.Failed ? 'danger' : status;
-          const timerTime = end_time
-            ? extendedDayjs(extendedDayjs.utc(end_time - start_time)).format(
-                TIME_WITH_MS,
-              )
-            : '00:00:00.000';
+          // Use start_running_time if available for more accurate duration
+          const startTime = start_running_time || start_time;
+          const timerTime =
+            end_time && startTime
+              ? extendedDayjs(extendedDayjs.utc(end_time - startTime)).format(
+                  TIME_WITH_MS,
+                )
+              : '00:00:00.000';
           return (
             <TimerLabel type={timerType} role="timer">
               {timerTime}
diff --git a/superset-frontend/src/views/CRUD/types.ts 
b/superset-frontend/src/views/CRUD/types.ts
index a80eadbec4..5ed2c6220d 100644
--- a/superset-frontend/src/views/CRUD/types.ts
+++ b/superset-frontend/src/views/CRUD/types.ts
@@ -104,6 +104,7 @@ export interface QueryObject {
     username: string;
   };
   start_time: number;
+  start_running_time: number | null;
   end_time: number;
   rows: number;
   tmp_table_name: string;
@@ -125,6 +126,7 @@ export enum QueryObjectColumns {
   User = 'user',
   UserFirstName = 'user.first_name',
   StartTime = 'start_time',
+  StartRunningTime = 'start_running_time',
   EndTime = 'end_time',
   Rows = 'rows',
   TmpTableName = 'tmp_table_name',
diff --git a/superset/queries/api.py b/superset/queries/api.py
index d29d52fd36..3b4b1e632f 100644
--- a/superset/queries/api.py
+++ b/superset/queries/api.py
@@ -91,6 +91,7 @@ class QueryRestApi(BaseSupersetModelRestApi):
         "user.id",
         "user.last_name",
         "start_time",
+        "start_running_time",
         "end_time",
         "tmp_table_name",
         "tracking_url",

Reply via email to