public
Created

  • Download Gist
gistfile1.sql
SQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
EXPLAIN for: SELECT `logs`.* FROM `logs` INNER JOIN `cloud_logs` ON `cloud_logs`.`id` = `logs`.`cloud_log_id` INNER JOIN `client_application_versions` ON `client_application_versions`.`id` = `cloud_logs`.`client_application_version_id` INNER JOIN `client_applications` ON `client_applications`.`id` = `client_application_versions`.`client_application_id` INNER JOIN `cloud_logs` `cloud_logs_logs_join` ON `cloud_logs_logs_join`.`id` = `logs`.`cloud_log_id` INNER JOIN `client_application_versions` `client_application_versions_logs` ON `client_application_versions_logs`.`id` = `cloud_logs_logs_join`.`client_application_version_id` WHERE (logs.deleted_at IS NULL) AND (client_applications.account_id = '3') AND (client_applications.id = '5') AND (client_application_versions.id = '15') ORDER BY timestamp DESC LIMIT 100 OFFSET 0
+----+-------------+----------------------------------+--------+--------------------------------------------------------------------+---------------------------------------------------+---------+------------------------------------------------------------------------+------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------------------------+--------+--------------------------------------------------------------------+---------------------------------------------------+---------+------------------------------------------------------------------------+------+---------------------------------+
| 1 | SIMPLE | client_application_versions | const | PRIMARY,index_client_application_versions_on_client_application_id | PRIMARY | 4 | const | 1 | Using temporary; Using filesort |
| 1 | SIMPLE | client_applications | const | PRIMARY,index_client_applications_on_account_id | PRIMARY | 4 | const | 1 | |
| 1 | SIMPLE | cloud_logs | ref | PRIMARY,index_cloud_logs_on_client_application_version_id | index_cloud_logs_on_client_application_version_id | 5 | const | 3346 | Using where; Using index |
| 1 | SIMPLE | cloud_logs_logs_join | eq_ref | PRIMARY,index_cloud_logs_on_client_application_version_id | PRIMARY | 4 | cloudlog_production.cloud_logs.id | 1 | |
| 1 | SIMPLE | client_application_versions_logs | eq_ref | PRIMARY | PRIMARY | 4 | cloudlog_production.cloud_logs_logs_join.client_application_version_id | 1 | Using index |
| 1 | SIMPLE | logs | ref | index_logs_on_cloud_log_id | index_logs_on_cloud_log_id | 5 | cloudlog_production.cloud_logs.id | 5 | Using where |
+----+-------------+----------------------------------+--------+--------------------------------------------------------------------+---------------------------------------------------+---------+------------------------------------------------------------------------+------+---------------------------------+
 
 
 
 
 
 
EXPLAIN for SELECT `logs`.* FROM `logs` INNER JOIN `cloud_logs` ON `cloud_logs`.`id` = `logs`.`cloud_log_id` INNER JOIN `client_application_versions` ON `client_application_versions`.`id` = `cloud_logs`.`client_application_version_id` INNER JOIN `client_applications` ON `client_applications`.`id` = `client_application_versions`.`client_application_id` WHERE (logs.deleted_at IS NULL) AND (client_applications.account_id = '3') AND (client_applications.id = '5') ORDER BY timestamp DESC LIMIT 100 OFFSET 0
+----+-------------+-----------------------------+-------+--------------------------------------------------------------------+------------------------------------------------------------+---------+----------------------------------------------------+------+---------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------------------+-------+--------------------------------------------------------------------+------------------------------------------------------------+---------+----------------------------------------------------+------+---------------------------------+
| 1 | SIMPLE | client_applications | const | PRIMARY,index_client_applications_on_account_id | PRIMARY | 4 | const | 1 | Using temporary; Using filesort |
| 1 | SIMPLE | client_application_versions | ref | PRIMARY,index_client_application_versions_on_client_application_id | index_client_application_versions_on_client_application_id | 5 | const | 7 | Using where; Using index |
| 1 | SIMPLE | cloud_logs | ref | PRIMARY,index_cloud_logs_on_client_application_version_id | index_cloud_logs_on_client_application_version_id | 5 | cloudlog_production.client_application_versions.id | 557 | Using where; Using index |
| 1 | SIMPLE | logs | ref | index_logs_on_cloud_log_id | index_logs_on_cloud_log_id | 5 | cloudlog_production.cloud_logs.id | 5 | Using where |
+----+-------------+-----------------------------+-------+--------------------------------------------------------------------+------------------------------------------------------------+---------+----------------------------------------------------+------+---------------------------------+
 
 
 
 
 
EXPLAIN for: SELECT `logs`.* FROM `logs` INNER JOIN `cloud_logs` ON `cloud_logs`.`id` = `logs`.`cloud_log_id` INNER JOIN `client_application_versions` ON `client_application_versions`.`id` = `cloud_logs`.`client_application_version_id` INNER JOIN `client_applications` ON `client_applications`.`id` = `client_application_versions`.`client_application_id` WHERE (logs.deleted_at IS NULL) AND (client_applications.account_id = '3') ORDER BY timestamp DESC LIMIT 100 OFFSET 0
+----+-------------+-----------------------------+------+--------------------------------------------------------------------+------------------------------------------------------------+---------+----------------------------------------------------+------+-----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------------------+------+--------------------------------------------------------------------+------------------------------------------------------------+---------+----------------------------------------------------+------+-----------------------------------------------------------+
| 1 | SIMPLE | client_applications | ref | PRIMARY,index_client_applications_on_account_id | index_client_applications_on_account_id | 5 | const | 1 | Using where; Using index; Using temporary; Using filesort |
| 1 | SIMPLE | client_application_versions | ref | PRIMARY,index_client_application_versions_on_client_application_id | index_client_application_versions_on_client_application_id | 5 | cloudlog_production.client_applications.id | 4 | Using where; Using index |
| 1 | SIMPLE | cloud_logs | ref | PRIMARY,index_cloud_logs_on_client_application_version_id | index_cloud_logs_on_client_application_version_id | 5 | cloudlog_production.client_application_versions.id | 557 | Using where; Using index |
| 1 | SIMPLE | logs | ref | index_logs_on_cloud_log_id | index_logs_on_cloud_log_id | 5 | cloudlog_production.cloud_logs.id | 5 | Using where |
+----+-------------+-----------------------------+------+--------------------------------------------------------------------+------------------------------------------------------------+---------+----------------------------------------------------+------+-----------------------------------------------------------+
 
 
 
 
 
EXPLAIN for: SELECT `logs`.* FROM `logs` WHERE (logs.deleted_at IS NULL) ORDER BY timestamp DESC LIMIT 100 OFFSET 0
+----+-------------+----------------------------------+-------+---------------+-------------------------+---------+-----+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+----------------------------------+-------+---------------+-------------------------+---------+-----+--------+-------------+
| 1 | SIMPLE | logs | index | | index_logs_on_timestamp | 5 | | 694335 | Using where |
+----+-------------+----------------------------------+-------+---------------+-------------------------+---------+-----+--------+-------------+

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.