List:General Discussion« Previous MessageNext Message »
From:Baron Schwartz Date:February 10 2009 8:24pm
Subject:Re: Size limitation of user variable?
View as plain text  
On Tue, Feb 10, 2009 at 1:29 PM, Cantwell, Bryan
<bcantwell@stripped> wrote:
> I am trying to put the result of a function that returns MEDIUMTEXT into
> a user variable in my procedure. I haven't attempted to push the limits
> of the MEDIUMTEXT size, but wonder if the user variable can even handle
> this?


The REPEAT() function helps here:

mysql> set @var := repeat('a', 1024 * 1024);
Query OK, 0 rows affected (0.05 sec)

mysql> select length(@var);
+--------------+
| length(@var) |
+--------------+
|      1048576 |
+--------------+
1 row in set (0.01 sec)

So it accepts a mebibyte, let's see if we can notch that up :)

mysql> set @var := repeat('a', 1024 * 1024 * 1024);
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+------------------------------------------------------------------------------+
| Level   | Code | Message
                         |
+---------+------+------------------------------------------------------------------------------+
| Warning | 1301 | Result of repeat() was larger than
max_allowed_packet (16777216) - truncated |
+---------+------+------------------------------------------------------------------------------+
1 row in set (0.00 sec)

-- 
Baron Schwartz, Director of Consulting, Percona Inc.
Our Blog: http://www.mysqlperformanceblog.com/
Our Services: http://www.percona.com/services.html
Thread
db setupPJ9 Feb
  • Re: db setupOlaf Stein9 Feb
  • Re: db setup - correctionOlaf Stein9 Feb
    • Re: db setup - correctionPJ9 Feb
      • Re: db setup - correctionPeter Brawley9 Feb
        • Re: db setup - correctionOlaf Stein9 Feb
        • Re: db setup - correctionPJ9 Feb
          • Re: db setup - correctionOlaf Stein9 Feb
          • Re: db setup - correctionPeter Brawley9 Feb
            • Re: db setup - correctionPJ10 Feb
              • Re: db setup - correctionPeter Brawley10 Feb
                • Re: db setup - correctionPJ10 Feb
                  • Re: db setup - correctionPeter Brawley10 Feb
                  • Re: db setup - correctionddevaudreuil10 Feb
                    • Size limitation of user variable?Bryan Cantwell10 Feb
                      • Re: Size limitation of user variable?Baron Schwartz10 Feb
                        • Re: Size limitation of user variable?Johan De Meersman11 Feb
                          • Re: Size limitation of user variable?Baron Schwartz11 Feb
Re: db setup - correctionPJ10 Feb