MySQL group_concat Character Limit

MySQL group_concat Character Limit

GROUP_CONCAT  in MySQL is quite a handy function and I have used it lots of times to solve problems in my professional life. And today I just used it to solve a memory issue I have in my PHP script which requires grouping of data. It all worked OK if you work with very small data set, but problems will arise if you need to process hundreds of millions of rows of data – MySQL does not return all data set required in the GROUP BY and will simply truncate the data based on the group_concat_max_len configuration in MySQL, and the default value is only 1024. If you are working with a big data set, it is advised to set this config at run time so that you won’t get the unexpected behaviour:


Be mindful that although you can change the limit for GROUP_CONCAT, the upper limit is still controlled by the max_allowed_packet, please refer to MySQL documentation for more details.


My new Snowflake Blog is now live. I will not be updating this blog anymore but will continue with new contents in the Snowflake world!