30

I am using a group_concat to concatenate a lot of rows into one.

I set group concat to 10000 using:

SET group_concat_max_len = 10000;

But even then, my output cells remain incomplete and end with ...

I tried setting group_concat_max_len = 20000 and even that didn't help.

I also tried setting group_concat_max_len to 99999999. It still doesn't complete my output text. And I checked one of the group concat stops at Length = 230 characters and then gives ...

Is there any other way?

8
  • 1
    dev.mysql.com/doc/refman/5.6/en/… 18446744073709551615
    – Mihai
    Oct 24, 2014 at 18:14
  • 1
    @Mihai, why not post that as answer?
    – Rahul
    Oct 24, 2014 at 18:16
  • 2
    @Rahul Eh,just a quick google search,I`m more interested in learning something rather than break the point bank.
    – Mihai
    Oct 24, 2014 at 18:19
  • 2
    USe SET SESSION group_concat_max_len =.. before any query.
    – Mihai
    Oct 24, 2014 at 18:20
  • 2
    Yeah, I posted my answer about 1 minute after Mihai commented. If I had wanted to post just a link with no descriptive text, I probably would have been simultaneous. I don't care that much about the points either, but if questions are answered in comments alone, they always remain in the "unanswered" queue. People who don't post real answers are breaking StackOverflow's intended usage. Oct 24, 2014 at 18:22

2 Answers 2

44

Check out this link: https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_group_concat_max_len

All the MySQL configuration variables are documented on that page, with details like minimum, maximum, default value, whether you can set them globally or per-session, whether you can change them on a running instance or does it require a restart, and other description of usage.

The maximum value for group_concat_max_len is 18446744073709551615.

The group-concat string does not end with "..." If you try to group too much text, it just gets truncated. So I wonder if the problem is not with MySQL's settings, but with the display of your cells.

9
  • I set it to max now (18446744073709551615) My string still gets cut off at the same place where it was earlier getting cut off. Hence, the change isn't getting effective clearly. I closed my MySQL workbench and restarted it. But I am probably required to restart the MySQL instance. Oct 24, 2014 at 18:19
  • 1
    Like I said, this is probably a limitation of the display, not the MySQL server. Oct 24, 2014 at 18:22
  • 1
    Yes, that's exactly it. You can try a query like select repeat('a', 1024*1024) and see the "..." there too. It's an issue of MySQL Workbench showing only a limited prefix of the string, even though the server has sent back a long string. Oct 24, 2014 at 20:33
  • 2
    Yes. It worked programatically. So, the truncation was occuring on client side not on the server side. Oct 24, 2014 at 21:13
  • 1
    if youre using workbench, you can right click the column and select `Open value in viewer' to see the whole string Feb 10, 2015 at 13:32
20

For 32bit systems, the maximum value is 4294967295

For 64 bit systems, the maximum value is 18446744073709551615.

You can set the variable for your current session using

SET SESSION group_concat_max_len=4294967295;

To set the variable forever use

SET GLOBAL group_concat_max_len=4294967295;

(see http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_group_concat_max_len)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.