Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24684

Aggregate functions min max over a partition have quadratic complexity

    XMLWordPrintable

Details

    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;

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              stephane@skysql.com VAROQUI Stephane
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.