fix issue for detail

This commit is contained in:
ganyang
2022-01-24 10:20:33 +08:00
committed by kidhasdream
parent 3751f522e1
commit f6cd0050fa
13 changed files with 101 additions and 60 deletions

View File

@ -352,20 +352,18 @@ void ExplainQuery(
else if (strcmp(opt->defname, "buffers") == 0)
es.buffers = defGetBoolean(opt);
#ifdef ENABLE_MULTIPLE_NODES
#ifdef PGXC
else if (strcmp(opt->defname, "nodes") == 0)
es.nodes = defGetBoolean(opt);
else if (strcmp(opt->defname, "num_nodes") == 0)
es.num_nodes = defGetBoolean(opt);
#endif /* PGXC */
else if (pg_strcasecmp(opt->defname, "detail") == 0)
es.detail = defGetBoolean(opt);
#endif /* ENABLE_MULTIPLE_NODES */
else if (strcmp(opt->defname, "timing") == 0) {
timing_set = true;
es.timing = defGetBoolean(opt);
} else if (pg_strcasecmp(opt->defname, "cpu") == 0)
es.cpu = defGetBoolean(opt);
else if (pg_strcasecmp(opt->defname, "detail") == 0)
es.detail = defGetBoolean(opt);
else if (pg_strcasecmp(opt->defname, "performance") == 0)
es.performance = defGetBoolean(opt);
else if (strcmp(opt->defname, "format") == 0) {

View File

@ -1360,7 +1360,7 @@ select * from (select t11.c1 a from t11 left join t12 on t11.c1 = t12.c2) inner
10 | 10 | 10 | 10
(10 rows)
explain (verbose on, costs off, analyze on, timing off, detail off, cpu off)
explain (verbose on, costs off, analyze on, timing off, cpu off)
select * from (select t11.c1 a from t11 left join t12 on t11.c1 = t12.c2) inner join t13 on (a = c3) order by 1,2,3,4;
QUERY PLAN
---------------------------------------------------------------------------------

View File

@ -0,0 +1,24 @@
CREATE TABLE detail_1(
id int,
name text,
person text
);
create table detail_2(
id int,
name text,
value text,
primary key(id)
);
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "detail_2_pkey" for table "detail_2"
insert into detail_1 values(1, 'a', 'aaa');
insert into detail_2 values(1, 'b', 'bbb');
explain (costs on, verbose on, analyse on, cpu on, detail off, buffers on) select * from detail_1;
ERROR: unrecognized EXPLAIN option "detail"
explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select * from detail_2;
ERROR: unrecognized EXPLAIN option "detail"
explain (detail on) select * from detail_1;
ERROR: unrecognized EXPLAIN option "detail"
explain (detail off) select * from detail_2;
ERROR: unrecognized EXPLAIN option "detail"
drop table detail_1;
drop table detail_2;

View File

@ -834,7 +834,7 @@ explain (verbose on, costs off, analyze on) select * from llvm_vecexpr_table_03
--? Total runtime: .*
(6 rows)
explain (analyze on, detail on, costs off, timing off) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off) select * from llvm_vecexpr_table_03 where col_int > 4;
QUERY PLAN
----------------------------------------------------------------------------------------------
Row Adapter (actual rows=9 loops=1)
@ -843,7 +843,7 @@ explain (analyze on, detail on, costs off, timing off) select * from llvm_vecexp
--? Total runtime: .*
(4 rows)
explain (analyze on, detail on, costs off, timing off, format json) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off, format json) select * from llvm_vecexpr_table_03 where col_int > 4;
QUERY PLAN
-----------------------------------------------------
[ +
@ -874,7 +874,7 @@ explain (analyze on, detail on, costs off, timing off, format json) select * fro
]
(1 row)
explain (analyze on, detail on, costs off, timing off, format xml) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off, format xml) select * from llvm_vecexpr_table_03 where col_int > 4;
QUERY PLAN
----------------------------------------------------------------------------
<explain xmlns="http://www.postgresql.org/2009/explain"> +
@ -905,7 +905,7 @@ explain (analyze on, detail on, costs off, timing off, format xml) select * from
</explain>
(1 row)
explain (analyze on, detail on, costs off, timing off, format yaml) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off, format yaml) select * from llvm_vecexpr_table_03 where col_int > 4;
QUERY PLAN
------------------------------------------------
- Plan: +

View File

@ -12,7 +12,7 @@ create table regex_2 (
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "regex_2_pkey" for table "regex_2"
insert into regex_1 values(1, 'a', 'aaa');
insert into regex_2 values(1, 'b', 'bbb');
explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select * from regex_1;
explain (costs on, verbose on, analyse on, cpu on, buffers on) select * from regex_1;
QUERY PLAN
------------------------------------------------------------------------------------------------------------
--? Seq Scan on public.regex_1 \(cost=[0-9]*\.[0-9]*\.\.[0-9]*\.[0-9]* rows=833 width=68\) \(actual time=[0-9]*\.[0-9]*\.\.[0-9]*\.[0-9]* rows=[0-9]* loops=[0-9]*\)
@ -22,7 +22,7 @@ explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select
--? Total runtime: [0-9]*\.[0-9]* ms
(5 rows)
explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select * from regex_2;
explain (costs on, verbose on, analyse on, cpu on, buffers on) select * from regex_2;
QUERY PLAN
------------------------------------------------------------------------------------------------------------
--? Seq Scan on public.regex_2 \(cost=[0-9]*\.[0-9]*\.\.[0-9]*\.[0-9]* rows=[0-9]* width=[0-9]*\) \(actual time=[0-9]*\.[0-9]*\.\.[0-9]*\.[0-9]* rows=[0-9]* loops=[0-9]*\)

View File

@ -12,11 +12,11 @@ analyze setop_hash_table_02;
--test row table
set work_mem=64;
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
\o
select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2 limit 50;
@ -26,11 +26,11 @@ select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02
set work_mem='128MB';
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
\o
select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2 limit 50;
select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2 limit 50;
@ -49,11 +49,11 @@ analyze vecsetop_hash_table_02;
set work_mem=64;
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
\o
select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2 limit 50;
select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2 limit 50;
@ -69,11 +69,11 @@ reset enable_compress_spill;
set work_mem='128MB';
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
\o
\! rm hw_setop_writefile.out
select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2 limit 50;

View File

@ -139,7 +139,7 @@ select 2 from vector_result_engine.vector_result_table_01 where col_int > 500 li
select count(*) from vector_result_engine.vector_result_table_01 t1 where exists (select t2.col_int from vector_result_engine.vector_result_table_01 t2 where col_int < 500);
\o vec_result_json.o
explain (analyze on, detail on, format json)select count(*) from vector_result_engine.vector_result_table_01 t1 where exists (select t2.col_int from vector_result_engine.vector_result_table_01 t2 where col_int < 500);
explain (analyze on, format json)select count(*) from vector_result_engine.vector_result_table_01 t1 where exists (select t2.col_int from vector_result_engine.vector_result_table_01 t2 where col_int < 500);
\o
\! rm vec_result_json.o
set enable_vector_engine=false;

View File

@ -9,11 +9,11 @@ analyze setop_hash_table_02;
--test row table
set work_mem=64;
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
\o
select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2 limit 50;
a | b
@ -237,11 +237,11 @@ select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02
set work_mem='128MB';
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 intersect select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except all select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from setop_hash_table_01 except select a,b from setop_hash_table_02 order by 1, 2;
\o
select a, b from setop_hash_table_01 intersect all select a,b from setop_hash_table_02 order by 1, 2 limit 50;
a | b
@ -472,11 +472,11 @@ analyze vec_setop_hash_table_01;
analyze vecsetop_hash_table_02;
set work_mem=64;
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
\o
select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2 limit 50;
a | b
@ -922,11 +922,11 @@ select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_t
reset enable_compress_spill;
set work_mem='128MB';
\o hw_setop_writefile.out
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on, detail on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 intersect select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except all select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
explain (analyze on) select a, b from vec_setop_hash_table_01 except select a,b from vecsetop_hash_table_02 order by 1, 2;
\o
\! rm hw_setop_writefile.out
select a, b from vec_setop_hash_table_01 intersect all select a,b from vecsetop_hash_table_02 order by 1, 2 limit 50;

View File

@ -195,7 +195,7 @@ select count(*) from vector_result_engine.vector_result_table_01 t1 where exists
(1 row)
\o vec_result_json.o
explain (analyze on, detail on, format json)select count(*) from vector_result_engine.vector_result_table_01 t1 where exists (select t2.col_int from vector_result_engine.vector_result_table_01 t2 where col_int < 500);
explain (analyze on, format json)select count(*) from vector_result_engine.vector_result_table_01 t1 where exists (select t2.col_int from vector_result_engine.vector_result_table_01 t2 where col_int < 500);
\o
\! rm vec_result_json.o
set enable_vector_engine=false;

View File

@ -349,7 +349,7 @@ select * from t11, t12 where t12.c2 = (select min(1) from t11) + t11.c1(+) or
------JoinExpr and (+) not in same query level is valid---
--select * from (select t11.c1 a from t11,t12 where t11.c1 = t12.c2(+)) inner join t13 on (a = c3) order by 1,2,3,4;
select * from (select t11.c1 a from t11 left join t12 on t11.c1 = t12.c2) inner join t13 on (a = c3) order by 1,2,3,4;
explain (verbose on, costs off, analyze on, timing off, detail off, cpu off)
explain (verbose on, costs off, analyze on, timing off, cpu off)
select * from (select t11.c1 a from t11 left join t12 on t11.c1 = t12.c2) inner join t13 on (a = c3) order by 1,2,3,4;
explain(verbose on, costs off)
select * from (select t11.c1 a from t11,t12 where t11.c1 = t12.c2(+)) inner join t13 on (a = c3) order by 1,2,3,4;

19
src/test/regress/sql/detail.sql Executable file
View File

@ -0,0 +1,19 @@
CREATE TABLE detail_1(
id int,
name text,
person text
);
create table detail_2(
id int,
name text,
value text,
primary key(id)
);
insert into detail_1 values(1, 'a', 'aaa');
insert into detail_2 values(1, 'b', 'bbb');
explain (costs on, verbose on, analyse on, cpu on, detail off, buffers on) select * from detail_1;
explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select * from detail_2;
explain (detail on) select * from detail_1;
explain (detail off) select * from detail_2;
drop table detail_1;
drop table detail_2;

View File

@ -174,10 +174,10 @@ set enable_seqscan=off;
set enable_bitmapscan=off;
explain (verbose on, costs off, analyze on) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, detail on, costs off, timing off) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, detail on, costs off, timing off, format json) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, detail on, costs off, timing off, format xml) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, detail on, costs off, timing off, format yaml) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off, format json) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off, format xml) select * from llvm_vecexpr_table_03 where col_int > 4;
explain (analyze on, costs off, timing off, format yaml) select * from llvm_vecexpr_table_03 where col_int > 4;
reset enable_seqscan;
----

View File

@ -11,8 +11,8 @@ create table regex_2 (
);
insert into regex_1 values(1, 'a', 'aaa');
insert into regex_2 values(1, 'b', 'bbb');
explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select * from regex_1;
explain (costs on, verbose on, analyse on, cpu on, detail on, buffers on) select * from regex_2;
explain (costs on, verbose on, analyse on, cpu on, buffers on) select * from regex_1;
explain (costs on, verbose on, analyse on, cpu on, buffers on) select * from regex_2;
explain (costs on, verbose on) select * from (select name from regex_1 intersect select name from regex_2 order by name) limit 10;
explain (costs on, verbose on) select * from (select name from regex_1 union select name from regex_2 order by name) limit 10;
explain (costs on, verbose on) insert into regex_1 (select * from regex_2);