- 论坛徽章:
- 1
|
MariaDB 10.0.10
1).
CREATE TABLE test_ind ( ID BIGINT(16) primary key NOT NULL auto_increment
, nTime INT(12)
, nSide INT(12)
) engine=memeory;
2).
show create table test_ind;
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test_ind | CREATE TABLE `test_ind` (
`ID` bigint(16) NOT NULL AUTO_INCREMENT,
`nTime` int(12) DEFAULT NULL,
`nSide` int(12) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM AUTO_INCREMENT=12702419 DEFAULT CHARSET=latin1 |
MyISAM 而不是 Memory!!! 不知道原因.
3).
insert 12m rows
select count(*) from test_ind;
+----------+
| count(*) |
+----------+
| 12702418 |
+----------+
1 row in set (0.08 sec)
4).
explain select * from test_ind order by id desc limit 100;
+------+-------------+----------+-------+---------------+---------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+----------+-------+---------------+---------+---------+------+------+-------+
| 1 | SIMPLE | test_ind | index | NULL | PRIMARY | 8 | NULL | 100 | |
+------+-------------+----------+-------+---------------+---------+---------+------+------+-------+
5).
select * from test_ind order by id desc limit 100;
+----------+-------+-------+
| ID | nTime | nSide |
+----------+-------+-------+
| 12702418 | 479 | 804 |
| 12702417 | 390 | 1530 |
| 12702416 | 1104 | 140 |
| 12702415 | 952 | 792 |
| 12702414 | 2221 | 323 |
| 12702413 | 916 | 1594 |
| 12702412 | 2353 | 995 |
| 12702411 | 1198 | 589 |
| 12702410 | 601 | 1800 |
| 12702409 | 1801 | 2401 |
| 12702408 | 1735 | 201 |
| 12702407 | 2461 | 1824 |
| 12702406 | 337 | 2494 |
| 12702405 | 2103 | 729 |
| 12702404 | 2735 | 262 |
| 12702403 | 207 | 2472 |
| 12702402 | 1133 | 2521 |
| 12702401 | 1369 | 1048 |
| 12702400 | 1096 | 931 |
| 12702399 | 1161 | 1516 |
| 12702398 | 2663 | 2430 |
| 12702397 | 2826 | 1628 |
| 12702396 | 335 | 166 |
| 12702395 | 1727 | 503 |
| 12702394 | 608 | 710 |
| 12702393 | 757 | 1776 |
| 12702392 | 531 | 1670 |
| 12702391 | 2703 | 2328 |
| 12702390 | 313 | 729 |
| 12702389 | 694 | 2279 |
| 12702388 | 1763 | 2397 |
| 12702387 | 979 | 2140 |
| 12702386 | 203 | 918 |
| 12702385 | 1986 | 32 |
| 12702384 | 1502 | 1299 |
| 12702383 | 617 | 71 |
| 12702382 | 2135 | 2005 |
| 12702381 | 105 | 2890 |
| 12702380 | 2651 | 2212 |
| 12702379 | 1251 | 681 |
| 12702378 | 14 | 859 |
| 12702377 | 223 | 736 |
| 12702376 | 468 | 2125 |
| 12702375 | 629 | 1071 |
| 12702374 | 1276 | 2691 |
| 12702373 | 1622 | 1229 |
| 12702372 | 283 | 2294 |
| 12702371 | 2750 | 1707 |
| 12702370 | 1440 | 2014 |
| 12702369 | 2068 | 2729 |
| 12702368 | 872 | 1537 |
| 12702367 | 2610 | 2940 |
| 12702366 | 2745 | 369 |
| 12702365 | 2839 | 452 |
| 12702364 | 688 | 1580 |
| 12702363 | 1469 | 1619 |
| 12702362 | 2024 | 908 |
| 12702361 | 2776 | 2071 |
| 12702360 | 2969 | 2937 |
| 12702359 | 1625 | 969 |
| 12702358 | 1767 | 1385 |
| 12702357 | 1883 | 1483 |
| 12702356 | 444 | 643 |
| 12702355 | 1395 | 1526 |
| 12702354 | 2228 | 2816 |
| 12702353 | 1881 | 2774 |
| 12702352 | 56 | 2210 |
| 12702351 | 909 | 2357 |
| 12702350 | 2246 | 2730 |
| 12702349 | 1308 | 1834 |
| 12702348 | 2510 | 568 |
| 12702347 | 487 | 1995 |
| 12702346 | 2416 | 2147 |
| 12702345 | 2379 | 1311 |
| 12702344 | 87 | 528 |
| 12702343 | 1585 | 969 |
| 12702342 | 1336 | 2319 |
| 12702341 | 1644 | 2454 |
| 12702340 | 655 | 1922 |
| 12702339 | 1867 | 2452 |
| 12702338 | 2869 | 295 |
| 12702337 | 2848 | 1683 |
| 12702336 | 2694 | 2186 |
| 12702335 | 1703 | 2761 |
| 12702334 | 1629 | 1918 |
| 12702333 | 1249 | 1075 |
| 12702332 | 788 | 723 |
| 12702331 | 1857 | 72 |
| 12702330 | 1833 | 2071 |
| 12702329 | 2330 | 2364 |
| 12702328 | 2381 | 94 |
| 12702327 | 766 | 936 |
| 12702326 | 353 | 965 |
| 12702325 | 659 | 2266 |
| 12702324 | 1686 | 2343 |
| 12702323 | 485 | 28 |
| 12702322 | 835 | 1798 |
| 12702321 | 2042 | 793 |
| 12702320 | 1219 | 1140 |
| 12702319 | 2012 | 2651 |
+----------+-------+-------+
100 rows in set (0.05 sec)
|
|