From: Johan De Meersman
Date: October 19 2011 11:21am
Subject: Re: Is it possible to make this more efficient?
List-Archive: http://lists.mysql.com/mysql/226101
Message-Id: <9e03c49d-7ea6-46fc-accc-c245fb9144f1@zimbra>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
----- Original Message -----
> From: "Sergei Petrunia"
>
> Create index on (importance, company_id) (or
> (company_id,importance), should
> not matter). When that index is present, the query should use ref
> access on it using both key parts (if by some crazy reason it doesn't, use FORCE
> INDEX to make it to). This way, you will be scanning as few rows as possible.
Umm... It might just be a matter of cardinality? :-) While the optimizer can be wrong at times (and it's certainly worth checking that) it does usually pick the best choices.
--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel