On 06/28/2011 08:55 AM, Jorgen Loland wrote:
> On 06/27/2011 03:18 PM, Martin Hansson wrote:
>> Øystein Grøvlen skrev 2011-06-16 12.18:
>>> My question is not whether ordered access is required or not, but whether
>>> is the only case where select-> quick is set, but not used.
>> I'm sorry for the late answer. I'm also sorry to say I don't know. It's on my
>> todo list to look this up, but I haven't gotten around to it yet.
> The general rule in the code seems to be that if there is a quick, it will be
> used. Unfortunately there are at least a few exceptions.
> test_if_skip_sort_order() may e.g. destroy a previously created quick and
> replace it with either a new quick or ref access.
> I think it works like this when we reach JOIN::exec():
> * If JOIN_TAB->type == JT_ALL and select->quick is set, range access is used.
> * If JOIN_TAB->type == JT_REF ref access is used even if select->quick is set
> But the optimizer may reconsider many times before that.
BTW, there are also a few exceptions in best_access_path().
Jørgen Løland | Senior Software Engineer | +47 73842138