I've read in many place the overall benefits of tokudb, mainly on insert speed but not much on read, so in set it up on a 5.5.38 mariadb under linux.
Server is a monster (32 cores, 256g ram, 256g ssd)
I dump an innodb table of 1.5M rows to make my comparison. (copying then converting to tokudb)
My reference has multiple indexes and a partition
CREATE TABLE IF NOT EXISTS `table1_tokudb` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`field1` int(10) unsigned NOT NULL,
`field2` int(10) unsigned NOT NULL,
`field3` int(10) unsigned NOT NULL,
`ts_date` date NOT NULL,
`ts_time` time NOT NULL,
`value` text,
`utc` datetime NOT NULL,
`field4` int(10) unsigned NOT NULL,
`field5` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`,`ts_date`),
UNIQUE KEY `unique_logvalue_by_date` (`field1`,`field2`,`field3`,`ts_date`,`ts_time`),
KEY `date_index` (`ts_date`),
KEY `time_index` (`ts_time`),
KEY `sensor_index` (`field1`),
KEY `attribute_index` (`field3`),
KEY `sensor_endpoint_attribute` (`field1`,`field2`,`field3`)
) ENGINE=TokuDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4
/*!50100 PARTITION BY HASH (MONTH(ts_date))
PARTITIONS 13 */ AUTO_INCREMENT=140694470 ;
The dataset in innodb requires 88Mo for data and 260 for Index
When i run select without cache i'm disappointed by the result and i'm wondering what is causing this issue without finding it.
SELECT SQL_NO_CACHE field1,count(*) FROM compare.table1 GROUP BY field1;
SELECT SQL_NO_CACHE field1,count(*) FROM compare.table1_tokudb GROUP BY field1;
average of tenth call gives the following results:
Innodb table: 0.24 second
tokudb table: 1.49 second
Is it because dataset resides in memory and tokudb shines when it does not fit anymore ?
Is it because innodb has right indexes
Is it because of partition ?
key block size ?
anyway the select rate is 7 times slower, and i'm wondering if something is wrong or if it's an average response time
any help appreciated