Skip to content

Instantly share code, notes, and snippets.

@glappen
Created October 6, 2014 16:35
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 glappen/6a3bedefc375b3c18227 to your computer and use it in GitHub Desktop.
Save glappen/6a3bedefc375b3c18227 to your computer and use it in GitHub Desktop.
mysql> explain SELECT COUNT(*) FROM `transactions` WHERE `transactions`.`transaction_type_id` = 1 AND (device_id IN (182)) AND (`transactions`.`created_at` BETWEEN '2014-09-21 15:37:00' AND '2014-10-07 15:37:00');
+----+-------------+--------------+-------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+---------+------+-------+---------------------------------------------------------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+--------------+-------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+---------+------+-------+---------------------------------------------------------------------------------------------------------+
| 1 | SIMPLE | transactions | index_merge | index_transactions_on_transaction_type_id,index_transactions_on_device_id,index_transactions_on_created_at | index_transactions_on_device_id,index_transactions_on_transaction_type_id | 5,5 | NULL | 19232 | Using intersect(index_transactions_on_device_id,index_transactions_on_transaction_type_id); Using where |
+----+-------------+--------------+-------------+------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+---------+------+-------+---------------------------------------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment