Hi,

for obvoius reasons I am not inclined to set max_allowed_packet to very large
values, especially on a busy web server. Nevertheless I would like to be able
to store moderately large chunks of data in a blob field. I wondered if it
would be possible to work around the max_allowed_packet limitation by storing
the data using several update queries. The verify this, I created the
following table:

mysql> describe foo;
+-------+----------+------+-----+---------+-------+
| Field | Type     | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id    | int(11)  |      | PRI | 0       |       |
| foo   | longblob | YES  |     | NULL    |       |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.00 sec)

I the initialised one row:

mysql> insert into foo values (1,'foo ');
Query OK, 1 row affected (0.00 sec)

With this query I inflated the blob field:

mysql> update foo set foo=concat(foo,foo); select id,length(foo) from foo;
Query OK, 1 row affected (0.00 sec)

+----+-------------+
| id | length(foo) |
+----+-------------+
|  1 |           8 |
+----+-------------+
1 row in set (0.00 sec)

But when the blob field reached max_allowed_packet size, it collapsed:

[...]
mysql> update foo set foo=concat(foo,foo); select id,length(foo) from foo;
Query OK, 1 row affected (0.03 sec)

+----+-------------+
| id | length(foo) |
+----+-------------+
|  1 |      524288 |
+----+-------------+
1 row in set (0.00 sec)

mysql> update foo set foo=concat(foo,foo); select id,length(foo) from foo;
Query OK, 1 row affected (0.01 sec)

+----+-------------+
| id | length(foo) |
+----+-------------+
|  1 |        NULL |
+----+-------------+
1 row in set (0.00 sec)

So max_allowed_packet applies to queries that move data back and forth server
internally only, too. *sigh*. Is there any other practicable way to handle
large amounts of data without overly increasing max_allowed_packet?

Regards
Joerg Henne
-----------------------------------------------------------
Send a mail to [EMAIL PROTECTED] with
unsubscribe mysql [EMAIL PROTECTED]
in the body of the message to unsubscribe from this list.

Reply via email to