Group_concat in MySQL has a length limit! Default 1024 (reprint)

Source: Internet
Author: User

In MySQL, there is a function called "Group_concat", the usual use may not find the problem, in the processing of big data, you will find that the content is intercepted,
In fact, MySQL internal to this is set, the default is not set the length is 1024, if we need to be larger, we need to manually modify the configuration file.

Detailed description is as follows:

After using the Group_concat, the Select has no effect if the limit is used. When you use Group_concat to connect fields, there is a length limit, not how many even. But you can set it up a bit. Using the Group_concat_max_len system variable, you can set the maximum allowable length. The syntax for doing this in a program is as follows, where Val is an unsigned integer: SET [SESSION | GLOBAL] Group_concat_max_len = val; if the maximum length has been set, the result is up to this maximum length. After you execute set GLOBAL Group_concat_max_len = 10 in SQLyog, the settings take effect when you reopen the SQLyog. ---------------------------------------------------------------Group_concat The value of a field by the specified character, the system default delimiter is a comma, The length of the characters that can be accumulated is 1024 bytes. These parameters can be modified. 1. Let's start with a simple example    select Group_concat (f_a) from T_one GROUP by f_b;   group queries by F_b to accumulate f_a in each group. 2. Modify the default delimiter    select Group_concat (f_a  separator  ' _ ') from T_one GROUP by f_b;   Separator   is a keyword followed by the character to be delimited 3. Sort    Select Group_concat (f_a order by f_a  separator  ' _ ') from T_one Gro Up by f_b;4. Modify the default character size    1). Add         group_concat_max_len in mysql config file = 102400 #你要的最大长度     2). Can be simpler, execute the statement, you can set the scope            SET GLOBAL group_concat_max_len=102400;            SET SESSION group_concat_max_len=102400;5. and concat use     Group_concat The Blob large object is returned by default, you can use Concat, Returns a string that can also be added to the returned content in addition to other data.

Reproduced in: http://blog.csdn.net/catoop/article/details/41805437

Group_concat in MySQL has a length limit! Default 1024 (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.