SELECT `optimization_keywords`.keyword, `optimization_keywords`.proj_id, `optimization_keywords`.opt_id, `optimization_keywords`.key_id,
`t0`.`meta` as pos0, `t1`.`meta` as pos1,
`t2`.status as projectstatus, `optimization_keywords`.status as keywordstatus,
`t3`.`lastsend` as lastsend, `t3`.`lastmanual` as lastmanual
FROM (`optimization_keywords` , `optimization_words_test`, `optimization_projects`)
LEFT JOIN `optimization_stats_new` as `t0` ON (`optimization_keywords`.`proj_id`=`t0`.`proj_id` AND `optimization_keywords`.`opt_id`=`t0`.`opt_id` AND `t0`.`date`='$dateTodayTImestampt' AND `t0`.`key_id`=`optimization_keywords`.`key_id`)
LEFT JOIN `optimization_stats_new` as `t1` ON (`optimization_keywords`.`proj_id`=`t1`.`proj_id` AND `optimization_keywords`.`opt_id`=`t1`.`opt_id` AND `t1`.`date`='$dateYesterdayTimestampt' AND `t1`.`key_id`=`optimization_keywords`.`key_id`)
LEFT JOIN `optimization_projects` as `t2` ON (`optimization_keywords`.`proj_id`=`t2`.`id`)
LEFT JOIN `optimization_projects_timer` as `t3` ON (`optimization_keywords`.`proj_id`=`t3`.site AND `optimization_keywords`.`opt_id`=`t3`.`opt_id` AND `t3`.searchEngine='meta')
WHERE `optimization_words_test`.`wordname` = `optimization_keywords`.keyword AND `optimization_words_test`.`system`='meta' AND `optimization_projects`.`meta`='1' AND `optimization_projects`.`id` = `optimization_keywords`.`proj_id`
GROUP BY keyword
CREATE TABLE IF NOT EXISTS `optimization_words_test` (
`id` int(3) NOT NULL AUTO_INCREMENT,
`wordname` tinytext CHARACTER SET cp1251 COLLATE cp1251_general_cs NOT NULL,
`system` enum('meta','msn','yandex') NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 AUTO_INCREMENT=28 ;
CREATE TABLE `optimization_keywords` (
`key_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`opt_id` int(10) unsigned NOT NULL,
`proj_id` int(10) unsigned NOT NULL,
`keyword` char(100) COLLATE cp1251_general_cs NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`order` int(3) NOT NULL,
`freq_query` int(10) unsigned NOT NULL,
`date_check_freq` int(11) unsigned NOT NULL,
`isgeo` tinyint(1) unsigned NOT NULL,
`date_geo` int(10) unsigned NOT NULL,
PRIMARY KEY (`key_id`),
UNIQUE KEY `opt_id` (`proj_id`,`opt_id`,`keyword`),
KEY `status` (`status`),
KEY `date_geo` (`date_geo`),
KEY `date_check_freq` (`date_check_freq`)
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs AUTO_INCREMENT=246364;
Помогите оптимизировать запрос.