Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: add sub plan info of shuffleReceiver when query explain analyze #27992

Merged
merged 11 commits into from
Nov 23, 2021
Prev Previous commit
Next Next commit
add a test case
  • Loading branch information
mmyj committed Sep 15, 2021
commit b034ab46581a638c9f284b6944f876a49276b592
46 changes: 46 additions & 0 deletions cmd/explaintest/t/explain_analyze.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
CREATE DATABASE IF NOT EXISTS TPCH;
USE TPCH;
CREATE TABLE IF NOT EXISTS part ( P_PARTKEY INTEGER NOT NULL,
P_NAME VARCHAR(55) NOT NULL,
P_MFGR CHAR(25) NOT NULL,
P_BRAND CHAR(10) NOT NULL,
P_TYPE VARCHAR(25) NOT NULL,
P_SIZE INTEGER NOT NULL,
P_CONTAINER CHAR(10) NOT NULL,
P_RETAILPRICE DECIMAL(15,2) NOT NULL,
P_COMMENT VARCHAR(23) NOT NULL,
PRIMARY KEY (P_PARTKEY));

CREATE TABLE IF NOT EXISTS supplier ( S_SUPPKEY INTEGER NOT NULL,
S_NAME CHAR(25) NOT NULL,
S_ADDRESS VARCHAR(40) NOT NULL,
S_NATIONKEY INTEGER NOT NULL,
S_PHONE CHAR(15) NOT NULL,
S_ACCTBAL DECIMAL(15,2) NOT NULL,
S_COMMENT VARCHAR(101) NOT NULL,
PRIMARY KEY (S_SUPPKEY),
CONSTRAINT FOREIGN KEY SUPPLIER_FK1 (S_NATIONKEY) references nation(N_NATIONKEY));

CREATE TABLE IF NOT EXISTS partsupp ( PS_PARTKEY INTEGER NOT NULL,
PS_SUPPKEY INTEGER NOT NULL,
PS_AVAILQTY INTEGER NOT NULL,
PS_SUPPLYCOST DECIMAL(15,2) NOT NULL,
PS_COMMENT VARCHAR(199) NOT NULL,
PRIMARY KEY (PS_PARTKEY,PS_SUPPKEY),
CONSTRAINT FOREIGN KEY PARTSUPP_FK1 (PS_SUPPKEY) references supplier(S_SUPPKEY),
CONSTRAINT FOREIGN KEY PARTSUPP_FK2 (PS_PARTKEY) references part(P_PARTKEY));
-- load stats.
load stats 's/tpch_stats/part.json';
load stats 's/tpch_stats/supplier.json';
load stats 's/tpch_stats/partsupp.json';
set @@session.tidb_executor_concurrency = 5;

explain analyze
SELECT MIN(ps_supplycost) over (partition by p_partkey) as min_ps_supplycost,
MAX(ps_supplycost) over (partition by ps_suppkey) as max_ps_supplycost
FROM tpch.part,
tpch.partsupp,
tpch.supplier
WHERE p_partkey = ps_partkey
AND s_suppkey = ps_suppkey
limit 10;