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

Spurious ER_OUT_OF_SORTMEMORY (1038): Out of sort memory on SELECT

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      --source include/have_innodb.inc
      CREATE TABLE t(c INT,c2 TEXT) ENGINE=InnoDB;
      SET @@SESSION.sort_buffer_size=30839;  # up to 30839: error, 30840: no error
      SELECT c,LAG(c,1) OVER w FROM t WINDOW w AS (PARTITION BY c2 ORDER BY c2);
      DROP TABLE t;  # Cleanup
      

      Leads to:

      CS 13.0.1 3a2f8e27981b76b99d2b87cc3bcec5ef022b2b23 (Debug, Clang 21.1.3-20250923) Build 10/04/2026

      mysqltest: At line 12: query 'SELECT c,LAG(c,1) OVER w FROM t WINDOW w AS (PARTITION BY c2 ORDER BY c2)' failed: ER_OUT_OF_SORTMEMORY (1038): Out of sort memory, consider increasing server sort buffer size
      

      Present in all versions. Interesting that changing it from 30839 to 30840 specifically makes it work.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.