--disable_abort_on_error DROP TABLE IF EXISTS `t1_2`; CREATE TABLE `t1_2` ( `aux1` bigint(20) default NULL, `aux2` bigint(20) default NULL, `my_bigint` bigint(20) default NULL, `my_varchar` varchar(50) default NULL, `my_bit` tinyint(1) default NULL, `my_decimal_64` decimal(64,30) default NULL, `my_decimal_big` decimal(100,0) default NULL, KEY `I1_my_decimal_64_1_2` (`my_decimal_64`), KEY `I2_my_decimal_64_1_2` (`my_decimal_64`,`aux1`), KEY `I3_my_decimal_64_1_2` (`aux2`,`my_decimal_64`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `t1_2` VALUES (10001,10001,9223372036854775807, '12345678901234567890123456789012345678901234567890',127, '10000000000000001761595319084122112.000000000000000000000000000000', '10000000000000000470601344959054695891559601407866630764278709534898249531392'), (10001,10001,9223372036854775807,'12345678901234567890123456789012345678901234567890',127, '10000000000000000608673814477275136.000000000000000000000000000000', '10000000000000000470601344959054695891559601407866630764278709534898249531392'); let $DEC_VAL= 9999999999999999999999999999999999.999999999999999999999999999999; SELECT my_decimal_64, my_bigint FROM t1_2; # Try direct hits via WHERE = . # This is not reasonable, because DECIMAL handling in MySQL 4.1 is not accurate. eval SELECT my_decimal_64 FROM t1_2 FORCE INDEX(I1_my_decimal_64_1_2) WHERE my_decimal_64 = $DEC_VAL ; eval SELECT my_decimal_64 FROM t1_2 FORCE INDEX(I2_my_decimal_64_1_2) WHERE my_decimal_64 = $DEC_VAL ; eval SELECT my_decimal_64 FROM t1_2 FORCE INDEX(I3_my_decimal_64_1_2) WHERE my_decimal_64 = $DEC_VAL ; # Try to catch the rows via small value range. eval SELECT my_decimal_64 FROM t1_2 FORCE INDEX(I1_my_decimal_64_1_2) WHERE my_decimal_64 BETWEEN $DEC_VAL * (1 - 1.0E-15) AND $DEC_VAL * (1 + 1.0E-15); eval SELECT my_decimal_64 FROM t1_2 FORCE INDEX(I2_my_decimal_64_1_2) WHERE my_decimal_64 BETWEEN $DEC_VAL * (1 - 1.0E-15) AND $DEC_VAL * (1 + 1.0E-15); eval SELECT my_decimal_64 FROM t1_2 FORCE INDEX(I3_my_decimal_64_1_2) WHERE my_decimal_64 BETWEEN $DEC_VAL * (1 - 1.0E-15) AND $DEC_VAL * (1 + 1.0E-15); DROP INDEX I1_my_decimal_64_1_2 ON t1_2; DROP INDEX I2_my_decimal_64_1_2 ON t1_2; DROP INDEX I3_my_decimal_64_1_2 ON t1_2; eval SELECT my_decimal_64 FROM t1_2 WHERE my_decimal_64 = $DEC_VAL ; eval SELECT my_decimal_64 FROM t1_2 WHERE my_decimal_64 BETWEEN $DEC_VAL * (1 - 1.0E-15) AND $DEC_VAL * (1 + 1.0E-15);