3

When doing:

mysql -u case -p < MyQuery.sql

with the query being:

SELECT JSON_ARRAYAGG(JSON_OBJECT('field1', field1, ...)) FROM db.table

the printed output is cut off at a random point, halfway a JSON tag. But it does end with ].

Apparently my 8000+ records are too much to handle for JSON_ARRAYAGG?

How can I work around this?

O. Jones
  • 103,626
  • 17
  • 118
  • 172
meaning-matters
  • 21,929
  • 10
  • 82
  • 142
  • 5
    I don't see a mention of a limit in the documentation, but maybe it's affected by `group_concat_max_len`. What is this set to, and how does it compare to the size of your aggregate result. – Barmar Dec 17 '20 at 22:31
  • 2
    Also try increasing `max_allowed_packet` – Barmar Dec 17 '20 at 22:32

1 Answers1

1

Although it's not documented, apparently the setting group_concat_max_length also limits the size of the results of JSON_xxxAGG() functions. Increase this to allow larger results.

Barmar
  • 741,623
  • 53
  • 500
  • 612