Skip to content

Instantly share code, notes, and snippets.

@zverok
Created November 25, 2013 18:20
Show Gist options
  • Save zverok/7645959 to your computer and use it in GitHub Desktop.
Save zverok/7645959 to your computer and use it in GitHub Desktop.
mysql> explain SELECT `mentions_client_549`.* FROM `mentions_client_549` INNER JOIN `mention_details` ON ((`mention_details`.`mention_id` = `mentions_client_549`.`id`) AND (`mention_details`.`client_id` = 549)) WHERE ((`created_at` >= '2013-01-24 20:00:00') AND (`url` LIKE BINARY '%vk.com%' ESCAPE '\\')) ORDER BY `created_at` DESC LIMIT 10 OFFSET 0\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: mention_details
type: ref
possible_keys: client_id,mention_details_client_id_label_id_index
key: mention_details_client_id_label_id_index
key_len: 4
ref: const
rows: 1427040
Extra: Using temporary; Using filesort
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: mentions_client_549
type: eq_ref
possible_keys: PRIMARY,ix_mentions_client_3_created_at
key: PRIMARY
key_len: 4
ref: brandspotter.mention_details.mention_id
rows: 1
Extra: Using where
-- 5 минут спустя
mysql> explain SELECT `mentions_client_549`.* FROM `mentions_client_549` INNER JOIN `mention_details` ON ((`mention_details`.`mention_id` = `mentions_client_549`.`id`) AND (`mention_details`.`client_id` = 549)) WHERE ((`created_at` >= '2013-01-24 20:00:00') AND (`url` LIKE BINARY '%vk.com%' ESCAPE '\\')) ORDER BY `created_at` DESC LIMIT 10 OFFSET 0\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: mentions_client_549
type: range
possible_keys: PRIMARY,ix_mentions_client_3_created_at
key: ix_mentions_client_3_created_at
key_len: 8
ref: NULL
rows: 3252522
Extra: Using where
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: mention_details
type: ref
possible_keys: client_id,mention_details_client_id_label_id_index
key: client_id
key_len: 8
ref: const,brandspotter.mentions_client_549.id
rows: 1
Extra: Using index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment