The database query uses GROUP_CONCAT. To increase the number of characters for the output string , you need to use

SET SESSION group_concat_max_len = 1000000; 

What is the best way to combine SET SESSION with SELECT? Does it make sense to use multi_query ? For example, so

 if ($mysqli->multi_query("SET SESSION group_concat_max_len = 1000000; SELECT url, title, (SELECT GROUP_CONCAT(CONCAT('<cite>', a.author, '</cite>', b.comment) separator '\n') FROM comment b, author a WHERE b.id_post = p.id AND a.id = b.id_author ORDER BY b.id) comment FROM post p WHERE id=1 LIMIT 1;")) { do { if ($result = $mysqli->store_result()) { $row = $result->fetch_assoc(); $result->free(); } } while ($mysqli->next_result()); } 

Confused by the presence of a do..while loop, although one line is required.

SET GLOBAL can not apply because it is used virtual hosting.

  • one
    Why you do not want to do separate requests? First SET SESSION, and then the usual SELECT? - Zhukov Roman
  • "Forwarding: to the server several expressions in one request reduces the number of client-server interactions." But I don’t even guess what the benefits of time can be there. - Natalia Mitrofanova
  • @ Natalya Mitrofanova if you are continuously interacting with the server, there are thousands more hits per second - it may make sense to bother, but this is an extremely rare task and there are already usually using other optimization methods - rjhdby
  • @ Natalia Mitrofanova optimization should be used when you understand that this is really a bottleneck in the application. - Zhukov Roman
  • Yeah, that is: "it works and well, don't bother, you can do it this way and that." :) Or is it better to do two requests? - Natalia Mitrofanova

0