MYSQL CONCAT MAX LENGTH

后端 未结 2 1027
轻奢々
轻奢々 2020-12-10 04:05

Following this post: POST ABOUT CONCAT My problem is that i have many rows CONCAT into one row. For example if i have 10 rows with string around 50 chars, my qu

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 05:10

    Presumably you're using GROUP_CONCAT(), not simple CONCAT().

    The default value of the group_concat_max_len is 1024, which is a pretty small limit if you're building up big long concatenations.

    To change it, use this command. I've set the length in this example to 100,000. You could set it to anything you need.

     SET SESSION group_concat_max_len = 100000;
    

    The usual value for max_allowed_packet is one megabyte, which is likely more than you need.

    group_concat_max_len itself has an effectively unlimited size. It's limited only by the unsigned word length of the platform: 2^32-1 on a 32-bit platform and 2^64-1 on a 64-bit platform.

    If that still isn't enough for your application, it's time to take @eggyal's suggestion and rethink your approach.

提交回复
热议问题