Skip to content

Instantly share code, notes, and snippets.

@krusty
Created May 21, 2013 15:11
Show Gist options
  • Save krusty/5620572 to your computer and use it in GitHub Desktop.
Save krusty/5620572 to your computer and use it in GitHub Desktop.
MariaDB []> explain select count(*) from api_person where age in (50,51) and state = 'OR';
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+--------+------------------------------------+
| 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 | 955522 | Using index condition; Using where |
+------+-------------+------------+-------+---------------------------------------------------------------------------------------------------------------------------------------+---------------------+---------+------+--------+------------------------------------+
1 row in set (0.00 sec)
MariaDB []> explain select count(*) from api_person where age in (50,51,52,53,54,55,56,57,58,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 | 27609895 | 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