Group_Concat Gotcha

July 31st, 2013

Recently I wrote about the awesome group_concat command in MySQL. Well I ran into a little bit of a problem with it. By default the max string length is only 1024 characters. I didn’t notice this until I was working with real data and all my text was showing up truncated in app. Luckily there is an environmental variable that can increase the concat buffer, group_concat_max_len. If you’re running straight SQL, type: SET GLOBAL group_concat_max_len = 32000; or whatever size you need.

Update: Use SET SESSION so you don't run into permission issues and unintended consequences. Thanks Fletch!