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

Aggregate functions min max over a partition have quadratic complexity

    XMLWordPrintable

Details

    • Bug
    • Status: In Testing (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4.17, 10.5.8, 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5(EOL), 10.6(EOL), 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 12.3
    • 11.4, 11.8, 12.3
    • None
    • Q4/2026 Server Maintenance, Q4/2026 Server Development

    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

              mariadb-pavithrapandith Pavithra Pandith
              stephane@skysql.com VAROQUI Stephane
              Alice Sherepa Alice Sherepa
              Oleg Smirnov Oleg Smirnov
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 2d 1h Remaining Estimate - 1d 7h
                  1d 7h
                  Logged:
                  Time Spent - 2d 1h Remaining Estimate - 1d 7h
                  2d 1h

                  Git Integration

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