【 TiDB 使用环境】
4台,16核64G内存
【问题】
SSB压测,q1.1测试结果查询耗时太长100秒
【 TiDB 版本】
V5.3
【执行计划】
Q1.1执行计划.html (9.4 KB)
Q1.1执行计划优化.html (18.9 KB)
【数据量】
【优化参数】
set @@session.tidb_allow_mpp=1;
set @@session.tidb_isolation_read_engines = "tiflash,tikv";
set @@tidb_mem_quota_query = 20 << 30;
set @@tidb_distsql_scan_concurrency = 15;
set @@tidb_opt_distinct_agg_push_down = 1;
set @@tidb_opt_agg_push_down = 1;
set @@tidb_allow_batch_cop = 1;
【建表语句】
create DATABASE if not exists db1;
CREATE TABLE `lineorder` (
`lo_orderkey` bigint(20) NULL COMMENT "",
`lo_linenumber` bigint(20) NULL COMMENT "",
`lo_custkey` int(11) NULL COMMENT "",
`lo_partkey` int(11) NULL COMMENT "",
`lo_suppkey` int(11) NULL COMMENT "",
`lo_orderdate` int(11) NULL COMMENT "",
`lo_orderpriority` varchar(16) NULL COMMENT "",
`lo_shippriority` int(11) NULL COMMENT "",
`lo_quantity` bigint(20) NULL COMMENT "",
`lo_extendedprice` bigint(20) NULL COMMENT "",
`lo_ordtotalprice` bigint(20) NULL COMMENT "",
`lo_discount` bigint(20) NULL COMMENT "",
`lo_revenue` bigint(20) NULL COMMENT "",
`lo_supplycost` bigint(20) NULL COMMENT "",
`lo_tax` bigint(20) NULL COMMENT "",
`lo_commitdate` bigint(20) NULL COMMENT "",
`lo_shipmode` varchar(11) NULL COMMENT ""
)
PARTITION BY RANGE(`lo_orderdate`)(
PARTITION p1992 VALUES LESS THAN (19930101),
PARTITION p1993 VALUES LESS THAN (19940101),
PARTITION p1994 VALUES LESS THAN (19950101),
PARTITION p1995 VALUES LESS THAN (19960101),
PARTITION p1996 VALUES LESS THAN (19970101),
PARTITION p1997 VALUES LESS THAN (19980101),
PARTITION p1998 VALUES LESS THAN (19990101)
);
CREATE TABLE `customer` (
`c_custkey` int(11) NULL COMMENT "",
`c_name` varchar(26) NULL COMMENT "",
`c_address` varchar(41) NULL COMMENT "",
`c_city` varchar(11) NULL COMMENT "",
`c_nation` varchar(16) NULL COMMENT "",
`c_region` varchar(13) NULL COMMENT "",
`c_phone` varchar(16) NULL COMMENT "",
`c_mktsegment` varchar(11) NULL COMMENT ""
);
CREATE TABLE `date` (
`d_datekey` int(11) NULL COMMENT "",
`d_date` varchar(20) NULL COMMENT "",
`d_dayofweek` varchar(10) NULL COMMENT "",
`d_month` varchar(11) NULL COMMENT "",
`d_year` int(11) NULL COMMENT "",
`d_yearmonthnum` int(11) NULL COMMENT "",
`d_yearmonth` varchar(9) NULL COMMENT "",
`d_daynuminweek` int(11) NULL COMMENT "",
`d_daynuminmonth` int(11) NULL COMMENT "",
`d_daynuminyear` int(11) NULL COMMENT "",
`d_monthnuminyear` int(11) NULL COMMENT "",
`d_weeknuminyear` int(11) NULL COMMENT "",
`d_sellingseason` varchar(14) NULL COMMENT "",
`d_lastdayinweekfl` int(11) NULL COMMENT "",
`d_lastdayinmonthfl` int(11) NULL COMMENT "",
`d_holidayfl` int(11) NULL COMMENT "",
`d_weekdayfl` int(11) NULL COMMENT ""
);
CREATE TABLE `part` (
`p_partkey` int(11) NULL COMMENT "",
`p_name` varchar(23) NULL COMMENT "",
`p_mfgr` varchar(7) NULL COMMENT "",
`p_category` varchar(8) NULL COMMENT "",
`p_brand` varchar(10) NULL COMMENT "",
`p_color` varchar(12) NULL COMMENT "",
`p_type` varchar(26) NULL COMMENT "",
`p_size` int(11) NULL COMMENT "",
`p_container` varchar(11) NULL COMMENT ""
);
CREATE TABLE `supplier` (
`s_suppkey` int(11) NULL COMMENT "",
`s_name` varchar(26) NULL COMMENT "",
`s_address` varchar(26) NULL COMMENT "",
`s_city` varchar(11) NULL COMMENT "",
`s_nation` varchar(16) NULL COMMENT "",
`s_region` varchar(13) NULL COMMENT "",
`s_phone` varchar(16) NULL COMMENT ""
);
【其他信息】