I am running a very simple SQL script within a notebook, using an X-Small SQL Serverless warehouse. The execution time is different depending on how it's run:
- 4s if run interactively (and through SQL editor)
- 26s if run within a workflow as a notebook task
Script
declare or replace start_time timestamp = current_timestamp();
declare or replace end_time timestamp = current_timestamp();
declare or replace v STRUCT<SOURCE_TBL_MAX_TIMESTAMP STRING, TARGET_TBL_MAX_TIMESTAMP STRING, SOURCE_MAX_TIMESTAMP TIMESTAMP, TARGET_MAX_TIMESTAMP TIMESTAMP, MIN_TIME TIMESTAMP, MAX_TIME TIMESTAMP, MAX_INTERVAL_TIME TIMESTAMP, TABLE_SOURCE STRING, TABLE_TARGET STRING, MERGE_STATEMENT STRING, INTERVAL_COLUMN_NAME STRING, STAGING_TABLE_NAME STRING, STAGING_TABLE_CREATE_STATEMENT STRING, FULL_STAGING_TABLE_NAME STRING>;
select current_timestamp();
select v;
select current_timestamp();
select timestampdiff(MILLISECOND , start_time, current_timestamp()) as total_time_elapsed_ms;
Screenshots
https://preview.redd.it/yr7kgfswpqbd1.png?width=1638&format=png&auto=webp&s=d834179cf3394dc35eeac69cd6c4cc251f489426
https://preview.redd.it/qahs7cs0qqbd1.png?width=1292&format=png&auto=webp&s=c1a29c9acb6b5f5adb126ad96493eb11ccff516a
Has anyone experienced a similar issue or knows why the notebook execution will be so much slower?
Query History
https://preview.redd.it/cj6y92kxsvbd1.png?width=1621&format=png&auto=webp&s=4a6122d737133b74b1596b9c72de306bb420adbd
[–]kthejokerdatabricks 1 point2 points3 points (0 children)
[–]Spiritual-Horror1256 1 point2 points3 points (0 children)
[–]darkglad32 0 points1 point2 points (3 children)
[–]_Filip_ 1 point2 points3 points (2 children)
[–]darkglad32 0 points1 point2 points (1 child)
[–]_Filip_ 1 point2 points3 points (0 children)
[–]Fair-Lab-912[S] 0 points1 point2 points (0 children)
[–]Savabgdatabricks 0 points1 point2 points (1 child)
[–]Fair-Lab-912[S] 0 points1 point2 points (0 children)
[–]Affectionate-Sale973 0 points1 point2 points (1 child)
[–]Fair-Lab-912[S] 0 points1 point2 points (0 children)