Comments on: Verifying GROUP_CONCAT limit without using variables https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables Blog by Shlomi Noach Mon, 16 Dec 2013 13:16:16 +0000 hourly 1 https://wordpress.org/?v=5.3.3 By: Mik https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-226186 Mon, 16 Dec 2013 13:16:16 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-226186 Use SUBSTRING_INDEX for GROUP_COCAT result to limit count of grouping items

]]>
By: SQL trick: overcoming GROUP_CONCAT limitation in special cases | code.openark.org https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-15986 Wed, 21 Jul 2010 13:14:35 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-15986 […] Verifying GROUP_CONCAT limit without using variables […]

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14651 Fri, 11 Jun 2010 04:58:46 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14651 @Justin,

Yes, I was referring to this type of solution on “…Using a stored function can do the trick…”.

It *is* somewhat evil 🙂

]]>
By: Justin Swanhart https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14642 Fri, 11 Jun 2010 02:26:03 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14642 Oh, and you don’t have to call it in group_concat, it can just be a select from dual.. I was just trying to trick MySQL into somehow evaluating the session var change in the same SQL statement, but that doesn’t work.

]]>
By: Justin Swanhart https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14641 Fri, 11 Jun 2010 02:24:15 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14641 It is kind of (well especially, perhaps) evil, but you could create a stored function that sets the session variables. Then instruct users to select from a view that invokes that SP before they select from any other views.

DELIMITER ;;
DROP FUNCTION IF EXISTS test.set_gc_len;;

CREATE FUNCTION test.set_gc_len (
)
RETURNS TINYTEXT
NO SQL
BEGIN
SET SESSION group_concat_max_len=65535;
RETURN ”;
END
;;

DELIMITER ;

CREATE VIEW `test`.`z1` AS select group_concat(`test`.`set_gc_len`() separator ‘,’) AS `group_concat(test.set_gc_len())`,(char_length(group_concat(repeat(‘0’,32768) separator ‘,’)) >= 32768) AS `group_concat_max_len_is_long_enough`;

— this first call to the view increases the max GC len
mysql> select * from test.z1\G
*************************** 1. row ***************************
group_concat(test.set_gc_len()):
group_concat_max_len_is_long_enough: 0
1 row in set, 1 warning (0.00 sec)

mysql> select * from test.z1\G
*************************** 1. row ***************************
group_concat(test.set_gc_len()):
group_concat_max_len_is_long_enough: 1
1 row in set (0.01 sec)

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14627 Thu, 10 Jun 2010 17:20:00 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14627 @Sheeri,
I figured you might have figured it ;), but there’s more to it.
The mycheckpoint monitoring tool works in a special way. The whole point of the tool is to create a sophisticated (if I may say so) views hierarchy; such that for getting monitored data (reports, charts, full blown HTML pages) — you don’t actually use the tool; you just query for the data, e.g.
SELECT html FROM sv_report_html_brief;
or
SELECT report FROM sv_report_human_sample;

So – no tool here. Nowhere to set the session variable. I hastily dropped in the openark-kit. You are correct: I do not have this issue there.

]]>
By: Sheeri Cabral https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14624 Thu, 10 Jun 2010 17:11:30 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14624 Shlomi — I figured it was in those tools. But if it’s just the tool checking a few things, then setting it *within* the tool will ensure that the tool always has it set appropriately. I’m talking about setting the *session* variable, not the *global* variable.

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14622 Thu, 10 Jun 2010 17:07:27 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14622 Hi Sheeri,
Fair question. Actually, it all comes up by issues I’m having with developing the openark-kit & mycheckpoint, two open source projects I’m working on.
The problem is, I have no idea who will install these, what their MySQL expertise will be; will they have privileges to change these settings, and so on.
I want the tools to handle these cases where the settings are insufficient.

Who knows how the next installation will go? Since the defaults are so low, how can I be sure that the next machine anyone sets up will have a manual setting for group_concat_max_len?

As long as the machines are mine, or under my control, yes – I just simple set up the variables as I please.

]]>
By: Sheeri Cabral https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14617 Thu, 10 Jun 2010 15:56:00 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14617 Why not just set the group_concat_max_len variable for the session so that you won’t have an issue with the operation no matter what?

]]>
By: shlomi https://shlomi-noach.github.io/blog/mysql/verifying-group_concat-limit-without-using-variables/comment-page-1#comment-14599 Thu, 10 Jun 2010 08:05:23 +0000 https://shlomi-noach.github.io/blog/?p=2534#comment-14599 Hi Roland,
Right, didn’t even mention it… 😀
Only available as of 5.1, while I have a requirement for 5.0 – 5.1.

Thank you for noting this down.

]]>