Aggregate functions min max over a partition have quadratic complexity

XMLWordPrintable

Details

• Bug
• Status: Confirmed
• Major
• Resolution: Unresolved
• 10.4.17, 10.5.8, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
• None

Description

create or replace table t(id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,part bigint(20) NOT NULL,ts bigint(20) DEFAULT NULL, key idx(part) );

set @seq:=1; insert into t select null ,1 , @seq;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
insert into t select null ,1 , @seq:=@seq+1 from t;
select part , MAX(ts) OVER (PARTITION BY part) AS ts_max FROM t where part=1;

People

Sergei Petrunia
VAROQUI Stephane