From e9067e95add60016cdcdf881aa45a933ae94d626 Mon Sep 17 00:00:00 2001 From: Julong-Li <584147810@qq.com> Date: Thu, 18 Jan 2024 10:32:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E6=B0=B4=E7=BA=BF=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E4=BF=AE=E6=94=B9:=20record=5Fslow=5Fsql=5Fi?= =?UTF-8?q?n=5Fproc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../expected/record_slow_sql_in_proc.out | 60 ++++++++----------- .../regress/sql/record_slow_sql_in_proc.sql | 22 +++---- 2 files changed, 37 insertions(+), 45 deletions(-) diff --git a/src/test/regress/expected/record_slow_sql_in_proc.out b/src/test/regress/expected/record_slow_sql_in_proc.out index ede0412e1..84916da5a 100644 --- a/src/test/regress/expected/record_slow_sql_in_proc.out +++ b/src/test/regress/expected/record_slow_sql_in_proc.out @@ -36,36 +36,28 @@ call test_slow_sql(); (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- (1 row) -select query, query_plan, is_slow_sql from statement_history where query_plan is not null order by start_time; - query | query_plan | is_slow_sql ------------------------+------------------------------------------------------------------+------------- - call test_slow_sql(); | Datanode Name: datanode1 +| t - | Function Scan on test_slow_sql (cost=0.25..0.26 rows=1 width=4)+| - | +| - | | - SELECT ? | Datanode Name: datanode1 +| f - | Result (cost=0.00..0.01 rows=1 width=0) +| - | +| - | | - SELECT pg_sleep(?) | Datanode Name: datanode1 +| t - | Result (cost=0.00..0.01 rows=1 width=0) +| - | +| - | | - call test_slow_sql(); | Datanode Name: datanode1 +| t - | Function Scan on test_slow_sql (cost=0.25..0.26 rows=1 width=4)+| - | +| - | | - SELECT pg_sleep(?) | Datanode Name: datanode1 +| t - | Result (cost=0.00..0.01 rows=1 width=0) +| - | +| - | | -(5 rows) +select query, query_plan, is_slow_sql from statement_history where parent_query_id != 0 order by start_time; + query | query_plan | is_slow_sql +--------------------+------------------------------------------+------------- + SELECT ? | Datanode Name: datanode1 +| f + | Result (cost=0.00..0.01 rows=1 width=0)+| + | +| + | | + SELECT pg_sleep(?) | Datanode Name: datanode1 +| t + | Result (cost=0.00..0.01 rows=1 width=0)+| + | +| + | | + SELECT pg_sleep(?) | Datanode Name: datanode1 +| t + | Result (cost=0.00..0.01 rows=1 width=0)+| + | +| + | | +(3 rows) delete from statement_history; set track_stmt_stat_level = 'L1,L1'; @@ -83,7 +75,7 @@ call test_exec_plsql(); (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -114,7 +106,7 @@ call test_exec_perform(); (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -145,7 +137,7 @@ call test_return_query(); 9909 | data9909 (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -185,7 +177,7 @@ NOTICE: id: 9909, name: data9909 (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -220,7 +212,7 @@ NOTICE: column_value: data9909 (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -257,7 +249,7 @@ NOTICE: (9909) (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -290,7 +282,7 @@ call test_exec_dynexecsql(1); (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -326,7 +318,7 @@ NOTICE: column_value: data9909 (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- @@ -368,7 +360,7 @@ referenced column: proc_pkg (1 row) -call pg_sleep(0.1); +call pg_sleep(0.2); pg_sleep ---------- diff --git a/src/test/regress/sql/record_slow_sql_in_proc.sql b/src/test/regress/sql/record_slow_sql_in_proc.sql index 434cde909..43205e7ca 100644 --- a/src/test/regress/sql/record_slow_sql_in_proc.sql +++ b/src/test/regress/sql/record_slow_sql_in_proc.sql @@ -25,8 +25,8 @@ call test_slow_sql(); -- record slow sql set track_stmt_stat_level = 'OFF,L1'; call test_slow_sql(); -call pg_sleep(0.1); -select query, query_plan, is_slow_sql from statement_history where query_plan is not null order by start_time; +call pg_sleep(0.2); +select query, query_plan, is_slow_sql from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; set track_stmt_stat_level = 'L1,L1'; @@ -40,7 +40,7 @@ INSERT INTO big_table (column1, column2) SELECT generate_series(1, 10000), 'data end; / call test_exec_plsql(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -53,7 +53,7 @@ PERFORM pg_sleep(0.1); END; / call test_exec_perform(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -67,7 +67,7 @@ RETURN QUERY SELECT column1, column2 FROM big_table WHERE column1 = 9909 ORDER B END; $$; call test_return_query(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -88,7 +88,7 @@ CLOSE cur; END; / call test_exec_open(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -104,7 +104,7 @@ END LOOP; END; / call test_exec_fors(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -122,7 +122,7 @@ END LOOP; END; / call test_exec_forc(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -137,7 +137,7 @@ EXECUTE sql_stmt; END; / call test_exec_dynexecsql(1); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -155,7 +155,7 @@ END LOOP; END; / call test_exec_dynfors(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; @@ -178,6 +178,6 @@ proc_pkg(); end test_proc_in_pkg; / select test_proc_in_pkg.proc_pkg(); -call pg_sleep(0.1); +call pg_sleep(0.2); select query, query_plan from statement_history where parent_query_id != 0 order by start_time; delete from statement_history; \ No newline at end of file