今天很奇怪的问题。像基本数学一样简单的查询:
MariaDB [betradar]> select id,id_event,id_bookmaker from event_outcome where id like '%16069689%';
+----------+----------+--------------+
| id | id_event | id_bookmaker |
+----------+----------+--------------+
| 16069689 | 11198 | 14 |
+----------+----------+--------------+
但是这个让我抓狂:
MariaDB [betradar]> select id,id_event from event_outcome where id=16069689;
Empty set (0.00 sec)
也就是说:尽管数据就在那里,但选择不会返回任何数据。这是与集群键相关的问题吗?我的桌子:
CREATE TABLE `event_outcome` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`id_event` int(11) unsigned NOT NULL,
`id_outcome` int(11) unsigned NOT NULL,
`id_bookmaker` int(11) unsigned NOT NULL,
`outcome_type` varchar(50) DEFAULT NULL ,
`quotation` decimal(10,2) NOT NULL,
`quotation_datetime` datetime DEFAULT NULL,
`is_last` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0',
`create_time` int(11) DEFAULT '0',
`update_time` int(11) DEFAULT '0',
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`mp_read` tinyint(4) DEFAULT '0',
PRIMARY KEY (`id`),
KEY `idx_event` (`id_event`),
KEY `idx_outcome` (`id_outcome`),
KEY `idx_bookmaker` (`id_bookmaker`),
KEY `idx_is_last` (`is_last`),
KEY `idx_outcome_type` (`outcome_type`),
KEY `clstr_event` (`id_event`,`id_outcome`,`id_bookmaker`,`is_last`,`mp_read`) `clustering`=yes
) ENGINE=TokuDB AUTO_INCREMENT=16632394 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT `compression`='tokudb_zlib'