dosubot[bot] commented on issue #30894: URL: https://github.com/apache/superset/issues/30894#issuecomment-2468333299
<!-- Answer --> The "Duration" column in the SQL Lab's "Query History" tab shows unexpected values because it calculates the duration using both the start and end timestamps of the query execution. The duration is computed using the `fDuration` function, which takes `q.startDttm` and `q.endDttm` as inputs. This means that the duration reflects the total time from when the query started to when it ended, which may include time spent in states other than just execution, such as queuing or waiting for resources <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/SqlLab/components/QueryTable/index.tsx)</sup>. The `fDuration` function calculates the duration by subtracting the start time from the end time to get the difference in milliseconds, then formats it as a UTC time string <sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/utils/dates.js)</sup>. The possible states a query can be in during its lifecycle include `Started`, `Stopped`, `Failed`, `Pending`, `Running`, `Scheduled`, `Success`, `Fetching`, and `TimedOut`. The `startDttm` is set when the query enters the `Started` state, and `endDttm` is set when the query reaches a concluded state, such as `Stopped`, `Failed`, `Success`, or `TimedOut` <sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/query/types/Query.ts)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
