All pastes #2081563 Raw Edit

Mine

public sql v1 · immutable
#2081563 ·published 2011-09-20 13:52 UTC
rendered paste body
mysql> show create table audio_clips\G*************************** 1. row ***************************       Table: audio_clipsCreate Table: CREATE TABLE `audio_clips` (  `id` int(11) NOT NULL auto_increment,  `title` varchar(255) default NULL,  `created_at` datetime default NULL,  `is_explicit` tinyint(1) NOT NULL default '0',  `is_public` tinyint(1) default NULL,  `is_available` tinyint(1) default NULL,  `activity` double NOT NULL default '10', --  (bunch of other columns here...)  PRIMARY KEY  (`id`),  KEY `index_audio_clips_on_is_public_and_created_at_and_is_explicit` (`is_public`,`created_at`,`is_explicit`),  KEY `index_a_c_on_activity_and_public_and_explicit` (`activity`,`is_public`,`is_explicit`) --  (bunch of other indexes here...) ) ENGINE=InnoDB AUTO_INCREMENT=477169 DEFAULT CHARSET=utf81 row in set (0.00 sec)-- on mysql 5.0.67mysql>  explain SELECT * FROM audio_clips WHERE is_public=1 AND is_explicit=0 ORDER BY activity DESC LIMIT 20 OFFSET 0\G*************************** 1. row ***************************           id: 1  select_type: SIMPLE        table: audio_clips         type: refpossible_keys: index_audio_clips_on_is_public_and_created_at_and_is_explicit          key: index_audio_clips_on_is_public_and_created_at_and_is_explicit      key_len: 2          ref: const         rows: 245541        Extra: Using where; Using filesort1 row in set (0.00 sec)-- on mysql 5.1.57mysql> explain SELECT * FROM audio_clips WHERE is_public=1 AND is_explicit=0 ORDER BY activity DESC LIMIT 20 OFFSET 0\G*************************** 1. row ***************************           id: 1  select_type: SIMPLE        table: audio_clips         type: indexpossible_keys: index_audio_clips_on_is_public_and_created_at_and_is_explicit          key: index_a_c_on_activity_and_public_and_explicit      key_len: 11          ref: NULL         rows: 55        Extra: Using where1 row in set (0.00 sec)