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

GROUP_CONCAT with ORDER BY inside takes a lot of memory while it's executed

    XMLWordPrintable

Details

    • 10.1.14, 10.1.18, 10.1.19

    Description

      A query like

      SELECT GROUP_CONCAT( seq, seq, seq, seq, seq, seq, seq, seq ORDER BY 2,1,3,4,6,5,8,7 ) AS cfield1 FROM seq_1_to_50000000

      easily uses up to 4-5 Gb memory while it's running.

      <montywi> everything has limits
      <montywi> even for filesort; For bigger things it should always hit disk, never memory
      ...
      <montywi> the problem is that when doing a sort, we create a sorted tree in memory
      <montywi> however there is no memory check for this
      <montywi> so this can be any size
      <montywi> Normally it would make sense to limit this to group_concat_max_length, but I fear that would break things, as we sort records there, which can have a notable overhead
      <montywi> So I have limit it to max_heap_table_size

      Attachments

        Activity

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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