DROP TABLE IF EXISTS t1; CREATE TABLE t1 (d1 DECIMAL(10,2) , d2 DECIMAL(60,10) , n1 NUMERIC , n2 NUMERIC(65,4) , d1 (d1) ) ENGINE= ; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 # 1 d1 # # NULL NULL # # INSERT INTO t1 (d1,d2,n1,n2) VALUES (10.22,60.12345,123456,14.3456), (10.0,60.12345,123456,14), (11.14,15,123456,13), (100,100,1,2), (0,0,0,0), (4540424564.23,3343303441.0,12,13), (15,17,23,100000); Warnings: Warning 1264 Out of range value for column 'd1' at row 6 SELECT d1 FROM t1 ORDER BY d1 DESC; d1 99999999.99 100.00 15.00 11.14 10.22 10.00 0.00 DROP TABLE t1; CREATE TABLE t1 (d1 DECIMAL(10,2) PRIMARY KEY, d2 DECIMAL(60,10) , n1 NUMERIC , n2 NUMERIC(65,4) ) ENGINE= ; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 0 PRIMARY 1 d1 # # NULL NULL # # INSERT INTO t1 (d1,d2,n1,n2) VALUES (10.22,60.12345,123456,14.3456), (10.0,60.12345,123456,14), (11.14,15,123456,13), (100,100,1,2), (0,0,0,0), (4540424564.23,3343303441.0,12,13), (15,17,23,100000); Warnings: Warning 1264 Out of range value for column 'd1' at row 6 EXPLAIN SELECT d1 FROM t1 ORDER BY d1 DESC; id select_type table type possible_keys key key_len ref rows Extra # # # # # PRIMARY # # # # SELECT d1 FROM t1 ORDER BY d1 DESC; d1 99999999.99 100.00 15.00 11.14 10.22 10.00 0.00 EXPLAIN SELECT d1 FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY d1 DESC; id select_type table type possible_keys key key_len ref rows Extra # # # # # PRIMARY # # # # SELECT d1 FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY) ORDER BY d1 DESC; d1 99999999.99 100.00 15.00 11.14 10.22 10.00 0.00 DROP TABLE t1; CREATE TABLE t1 (d1 DECIMAL(10,2) , d2 DECIMAL(60,10) , n1 NUMERIC , n2 NUMERIC(65,4) , UNIQUE INDEX n1_n2 (n1,n2) ) ENGINE= ; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 0 n1_n2 1 n1 # # NULL NULL # # t1 0 n1_n2 2 n2 # # NULL NULL # # INSERT INTO t1 (d1,d2,n1,n2) VALUES (10.22,60.12345,123456,14.3456), (10.0,60.12345,123456,14), (11.14,15,123456,13), (100,100,1,2), (0,0,0,0), (4540424564.23,3343303441.0,12,13), (15,17,23,100000); Warnings: Warning 1264 Out of range value for column 'd1' at row 6 EXPLAIN SELECT DISTINCT n1+n2 FROM t1; id select_type table type possible_keys key key_len ref rows Extra # # # # # n1_n2 # # # # SELECT DISTINCT n1+n2 FROM t1; n1+n2 0.0000 100023.0000 123469.0000 123470.0000 123470.3456 25.0000 3.0000 DROP TABLE t1; CREATE TABLE t1 (d1 DECIMAL(10,2) , d2 DECIMAL(60,10) , n1 NUMERIC , n2 NUMERIC(65,4) , INDEX (d2) ) ENGINE= ; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 d2 1 d2 # # NULL NULL # # INSERT INTO t1 (d1,d2,n1,n2) VALUES (10.22,60.12345,123456,14.3456), (10.0,60.12345,123456,14), (11.14,15,123456,13), (100,100,1,2), (0,0,0,0), (4540424564.23,3343303441.0,12,13), (15,17,23,100000); Warnings: Warning 1264 Out of range value for column 'd1' at row 6 EXPLAIN SELECT d2, COUNT(*) FROM t1 GROUP BY d2; id select_type table type possible_keys key key_len ref rows Extra # # # # # d2 # # # # SELECT d2, COUNT(*) FROM t1 GROUP BY d2; d2 COUNT(*) 0.0000000000 1 100.0000000000 1 15.0000000000 1 17.0000000000 1 3343303441.0000000000 1 60.1234500000 2 EXPLAIN SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2; id select_type table type possible_keys key key_len ref rows Extra # # # # # d2 # # # # SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2; d2 COUNT(*) 0.0000000000 1 100.0000000000 1 15.0000000000 1 17.0000000000 1 3343303441.0000000000 1 60.1234500000 2 DROP TABLE t1;