Skip to content

Instantly share code, notes, and snippets.

@krusty
Last active December 17, 2015 13:49
Show Gist options
  • Save krusty/5620146 to your computer and use it in GitHub Desktop.
Save krusty/5620146 to your computer and use it in GitHub Desktop.
MariaDB [****]> explain select count(*) from api_person where age >= 50 and age <= 59;
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+----------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+----------+--------------------------+
| 1 | SIMPLE | api_person | range | person_age_internet,person_age_status_internet_income_worth,person_age_status_income_stage_master_internet,person3,person4,person_age | person_age_internet | 5 | NULL | 11879780 | Using where; Using index |
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+----------+--------------------------+
1 row in set (0.81 sec)
MariaDB [****]> explain select count(*) from api_person where age >= 50 and age <= 59 and state = 'OR';
+------+-------------+------------+------+---------------------------------------------------------------------------------------------------------------------------------------+------+---------+------+----------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+------------+------+---------------------------------------------------------------------------------------------------------------------------------------+------+---------+------+----------+-------------+
| 1 | SIMPLE | api_person | ALL | person_age_internet,person_age_status_internet_income_worth,person_age_status_income_stage_master_internet,person3,person4,person_age | NULL | NULL | NULL | 27643940 | Using where |
+------+-------------+------------+------+---------------------------------------------------------------------------------------------------------------------------------------+------+---------+------+----------+-------------+
1 row in set (0.02 sec)
MariaDB [****]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment