Re: Simple 1-table query taking WAY to long.....
Posted by:
Rick James
Date: January 24, 2012 01:09AM
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
Redundant. A PRIMARY KEY is a UNIQUE KEY; DROP the UNIQUE KEY.
KEY `another_index` (`feed_id`,`sent_date`,`parsed`) USING BTREE,
KEY `index_email_reports_group_by_feed_and_date` (`feed_id`,`sent_date`),
Remove the second; it is covered by the first.
KEY `fk_email_reports_1` (`feed_id`),
Remove it; two other indexes cover it.
Notice that it picked index_email_reports_on_sent_timestamp...
Nearly 80% of the table has feed_id = 110. Will that continue to be the case? Or is it an anomoly? I ask because the optimizer may be deciding that the WHERE clause, and the otherwise useful index on (`feed_id`,`sent_timestamp`) are rather useless.
> `sent_timestamp` datetime DEFAULT NULL,
Being NULLable does not help; it may even be causing the INDEX to be ignored.
Subject
Views
Written By
Posted
1802
January 23, 2012 02:31AM
Re: Simple 1-table query taking WAY to long.....
1146
January 24, 2012 01:09AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.