← Back to team overview

maria-discuss team mailing list archive

Re: columns compression

 

Roberto,

If we simplify this even further, we'll end up with something like:
CREATE TABLE t1(a BLOB COMPRESSED);
INSERT INTO t1 VALUES(REPEAT('a', 65535));

We reserver 1 byte for compressed blobs to be able to store compression
metadata.

Unless I miss something, this is only required when we need to store data
uncompressed, which is edge case. In normal case we could probably remove
this restriction.

So this is pretty valid bug report. If there was some other restriction, we
should definitely document it.

Regards,
Sergey

On Sat, Mar 17, 2018 at 08:43:36AM -0300, Roberto Spadim wrote:
> Hi Sergey! I'm using a Azure VM (ubuntu), mariadb ubuntu package
> Server version: 10.3.5-MariaDB-10.3.5+maria~xenial mariadb.org binary
> distribution
> 
> 
> MariaDB [test]>  *CREATE TABLE `table_without_compression` (*
> *  `id` int(11) NOT NULL DEFAULT 0,*
> *  `gmtime` decimal(22,7) NOT NULL DEFAULT 0.0000000,*
> *  `data` blob NOT NULL,*
> *  PRIMARY KEY (`id`,`gmtime`)*
> *)  ENGINE=InnoDB DEFAULT CHARSET=latin1;*
> *Query OK, 0 rows affected (0.385 sec)*
> 
> MariaDB [test]>  *CREATE TABLE `table_compressed` (*
> *  `id` int(11) NOT NULL DEFAULT 0,*
> *  `gmtime` decimal(22,7) NOT NULL DEFAULT 0.0000000,*
> *  `data` blob COMPRESSED NOT NULL DEFAULT '',*
> *  PRIMARY KEY (`id`,`gmtime`)*
> *)  ENGINE=InnoDB DEFAULT CHARSET=latin1;*
> *Query OK, 0 rows affected (0.385 sec)*
> 
> 
> MariaDB [test]> INSERT INTO *table_without_compression VALUES
> (1,0,repeat('a',65535));*
> *Query OK, 1 row affected (0.135 sec)*
> 
> MariaDB [test]> * INSERT INTO  table_without_compression VALUES
> (1,1,repeat('a',65536));*
> *ERROR 1406 (22001): Data too long for column 'data' at row 1   <- JUST TO
> CHECK IF WE GOT MAX SIZE OF BLOB COLUMN, maybe that's the problem,
> internally compression consider the from/to column instead of a bigger
> column (long blob for example when using blob/longblob, i will test with
> TEXT/LONG TEXT and VARCHAR too)*
> 
> MariaDB [test]> *INSERT INTO table_compressed SELECT * FROM
> table_without_compression;*
> *ERROR 1406 (22001): Data too long for column 'data' at row 1 <- that's the
> error*
> 
> Should I include at Jira?


References