Skip to content

Instantly share code, notes, and snippets.

@hydrox
Created January 21, 2012 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hydrox/1653967 to your computer and use it in GitHub Desktop.
Save hydrox/1653967 to your computer and use it in GitHub Desktop.
mysql> explain select count(*) from hawkeye where player_id in (46) and (x between 3170 and 3730) and (y between 58 and 78) and (z between 2995 and 3015);
+----+-------------+---------+-------+-------------------------------------------------+--------------+---------+------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+-------------------------------------------------+--------------+---------+------+------+--------------------------+
| 1 | SIMPLE | hawkeye | range | player_action_world,x_y_z,player,player_x_y_z,x | player_x_y_z | 28 | NULL | 1 | Using where; Using index |
+----+-------------+---------+-------+-------------------------------------------------+--------------+---------+------+------+--------------------------+
1 row in set (0.00 sec)
mysql> drop index player_x_y_z on hawkeye;
Query OK, 871400 rows affected (42.12 sec)
Records: 871400 Duplicates: 0 Warnings: 0
mysql> explain select count(*) from hawkeye where player_id in (46) and (x between 3170 and 3730) and (y between 58 and 78) and (z between 2995 and 3015);
+----+-------------+---------+-------+------------------------------------+-------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+------------------------------------+-------+---------+------+------+-------------+
| 1 | SIMPLE | hawkeye | range | player_action_world,x_y_z,player,x | x_y_z | 24 | NULL | 233 | Using where |
+----+-------------+---------+-------+------------------------------------+-------+---------+------+------+-------------+
1 row in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment