Skip to content

Instantly share code, notes, and snippets.

@krusty
Last active December 17, 2015 13:49
Show Gist options
  • Save krusty/5620521 to your computer and use it in GitHub Desktop.
Save krusty/5620521 to your computer and use it in GitHub Desktop.
MariaDB []> create table test (a int, b int)
-> ;
Query OK, 0 rows affected (0.33 sec)
MariaDB []> create index test1 on test (a)
-> ;
Query OK, 0 rows affected (0.15 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB []> explain select * from test where a=1
-> ;
+------+-------------+-------+------+---------------+-------+---------+-------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+------+---------------+-------+---------+-------+------+-------+
| 1 | SIMPLE | test | ref | test1 | test1 | 5 | const | 1 | |
+------+-------------+-------+------+---------------+-------+---------+-------+------+-------+
1 row in set (0.08 sec)
MariaDB []> explain select * from test where a=1 and b=2;
+------+-------------+-------+------+---------------+-------+---------+-------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+------+---------------+-------+---------+-------+------+-------------+
| 1 | SIMPLE | test | ref | test1 | test1 | 5 | const | 1 | Using where |
+------+-------------+-------+------+---------------+-------+---------+-------+------+-------------+
1 row in set (0.00 sec)
MariaDB []>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment