Skip to content

Instantly share code, notes, and snippets.

@ramielrowe
Created July 29, 2013 18:37
Show Gist options
  • Save ramielrowe/6106567 to your computer and use it in GitHub Desktop.
Save ramielrowe/6106567 to your computer and use it in GitHub Desktop.
mysql> explain select max(length(`key`)), max(length(value)) from notifications;
+----+-------------+---------------+------+---------------+------+---------+------+-----------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------+------+---------------+------+---------+------+-----------+-------+
| 1 | SIMPLE | notifications | ALL | NULL | NULL | NULL | NULL | 262505557 | |
+----+-------------+---------------+------+---------------+------+---------+------+-----------+-------+
1 row in set (0.00 sec)
mysql> explain select max(length(value)) from notifications;
+----+-------------+---------------+-------+---------------+---------------------+---------+------+-----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------+-------+---------------+---------------------+---------+------+-----------+-------------+
| 1 | SIMPLE | notifications | index | NULL | notifications_value | 303 | NULL | 262505557 | Using index |
+----+-------------+---------------+-------+---------------+---------------------+---------+------+-----------+-------------+
1 row in set (0.00 sec)
mysql> explain select max(length(`key`)) from notifications;
+----+-------------+---------------+-------+---------------+-------------------+---------+------+-----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------------+-------+---------------+-------------------+---------+------+-----------+-------------+
| 1 | SIMPLE | notifications | index | NULL | notifications_key | 303 | NULL | 262505557 | Using index |
+----+-------------+---------------+-------+---------------+-------------------+---------+------+-----------+-------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment