Created
November 16, 2016 11:32
-
-
Save kamipo/130c15f6028ecd50fbd83a0873009f87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> create table t(a int, b int, primary key(a)); | |
Query OK, 0 rows affected (0.23 sec) | |
> insert into t values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10), | |
-> (11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19),(20,20), | |
-> (21,11),(22,12),(23,13),(24,14),(25,15),(26,16),(27,17),(28,18),(29,19),(30,30), | |
-> (31,11),(32,12),(33,13),(34,14),(35,15),(36,16),(37,17),(38,18),(39,19),(40,40), | |
-> (41,11),(42,12),(43,13),(44,14),(45,15),(46,16),(47,17),(48,18),(49,19),(50,50), | |
-> (51,11),(52,12),(53,13),(54,14),(55,15),(56,16),(57,17),(58,18),(59,19),(60,60); | |
Query OK, 60 rows affected (0.17 sec) | |
Records: 60 Duplicates: 0 Warnings: 0 | |
> set long_query_time = 0.0; | |
Query OK, 0 rows affected (0.16 sec) | |
> select * from t where b = 60 order by a desc limit 1; | |
+----+------+ | |
| a | b | | |
+----+------+ | |
| 60 | 60 | | |
+----+------+ | |
1 row in set (0.16 sec) | |
> select * from t where b = 60 limit 1; | |
+----+------+ | |
| a | b | | |
+----+------+ | |
| 60 | 60 | | |
+----+------+ | |
1 row in set (0.16 sec) | |
> select rows_sent, rows_examined, sql_text from mysql.slow_log; | |
+-----------+---------------+------------------------------------------------------+ | |
| rows_sent | rows_examined | sql_text | | |
+-----------+---------------+------------------------------------------------------+ | |
| 0 | 0 | set long_query_time = 0.0 | | |
| 1 | 1 | select * from t where b = 60 order by a desc limit 1 | | |
| 1 | 60 | select * from t where b = 60 limit 1 | | |
+-----------+---------------+------------------------------------------------------+ | |
3 rows in set (0.17 sec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment