Skip to content

Issue #10 - [BUG] SQL Lab Query History shows incorrect duration including queue time instead of execution time #31

@rogelio-cmj

Description

@rogelio-cmj

Motivation

SQL Lab's Query History tab displays a "Duration" column that should help users understand how long their queries actually took to execute. This is critical for performance analysis and query optimization. However, the current implementation calculates duration from when a query is submitted (start_time) to when it completes (end_time), which includes time spent waiting in queues, being scheduled, and other non-execution states. This makes the duration values misleading and unhelpful for users trying to understand actual query performance.

Current Behavior

The Duration column in SQL Lab's Query History tab calculates the total time from query submission to completion, including all intermediate states (pending, scheduled, queued, etc.) rather than just the actual execution time.

Reproduction Steps:

  1. Navigate to SQL Lab in Superset
  2. Execute several queries of varying complexity (e.g., simple SELECT statements, more complex joins)
  3. Click on the "Query History" tab
  4. Observe the "Duration" column values
  5. Notice that even simple queries that should execute in milliseconds may show durations of multiple seconds

Expected Behavior

The Duration column should display only the actual query execution time, excluding any time spent in pending, scheduled, or queued states.

Acceptance Criteria:

  • Duration calculation uses the time when query execution actually begins, not when it was submitted
  • The change works correctly for queries that have queue/scheduling delays

Steps to Test

  1. Start Superset and navigate to SQL Lab
  2. Execute multiple queries with different complexity levels
  3. Open the Query History tab
  4. Verify that duration values are reasonable and reflect actual execution time

https://github.com/apache/superset/pull/34511/files

Submission

Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.

Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions