List:Internals« Previous MessageNext Message »
From:xiao.feng Date:November 28 2006 12:27pm
Subject:RE: How to get key info of index?
View as plain text  
Hi,
 Is there any example of push-down conditions?
 The handler.h/cpp only defined cond_push, cond_pop, but there is no way of
using it.
 a > 5 and b > 6 and c > 7.
 when to push b > 6 or c >7, when to pop? Does the engine must support
restore the result before cond push.
 Thanks!
 


-----Original Message-----
From: Paul McCullagh [mailto:paul.mccullagh@stripped] 
Sent: Tuesday, November 21, 2006 11:36 PM
To: xiao.feng
Cc: Sergei Golubchik; MySQL Internal
Subject: Re: How to get key info of index?

I think only push-down conditions will solve your problem.

The engine API currently only supports basic index searches.

And an index search cannot be used to find "a > 5 and b > 6 and c >  
7", even given an index on (a, b, c). The system must search for "a >  
5", and then scan the rest of the index, filtering out the other  
conditions.

On Nov 21, 2006, at 2:05 PM, xiao.feng wrote:

>>>>> create table abc(a int, b int, c int);
>>>   create index idx_abc_all on abc(a, b, c).
>>>   select * from abc where a > 5 and b > 6 and c > 7;
>>> I can only get a, but no b and c.
> You say that: because MySQL creates the range 'a > 5' for the above  
> query,.
> but these condition, MySQL read a lot of unwanted records from my  
> storage engine.
> How to resolve this problem?
> Thanks!
>
>
> ----- Original Message -----
> From: "Sergei Golubchik" <serg@stripped>
> To: "xiao.feng" <xiao.feng@stripped>
> Cc: <internals@stripped>
> Sent: Tuesday, November 21, 2006 7:29 PM
> Subject: Re: How to get key info of index?
>
>
>> Hi!
>>
>> On Nov 17, xiao.feng wrote:
>>> Hi,
>>>   How to get key info of index?
>>>   create table abc(a int, b int, c int);
>>>   create index idx_abc_all on abc(a, b, c).
>>>   select * from abc where a > 5 and b > 6 and c > 7;
>>>
>>> int ha_test::read_range_first(const key_range *start_key, const  
>>> key_range *end_key, bool eq_range, bool sorted)
>>> how to use start_key and end_key to get the key info for a, b, c.
>>> I can only get a, but no b and c.
>>
>> Right, because MySQL creates the range 'a > 5' for the above  
>> query, and
>> you only see this in start_key. If you'll write
>>
>>  where a = b and b > 6 and c > 7
>>
>> then you'll see both a and b in start_key but not c.
>>
>> Regards,
>> Sergei
>>
>> -- 
>>   __  ___     ___ ____  __
>>  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
>> / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Senior Software Developer
>> /_/  /_/\_, /___/\___\_\___/  Kerpen, Germany
>>       <___/  www.mysql.com
>
> --
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe:    http://lists.mysql.com/internals? 
> unsub=paul.mccullagh@stripped
>

Thread
How to get key info of index?xiao.feng17 Nov
  • Re: How to get key info of index?xiao.feng19 Nov
    • Re: How to get key info of index?Sergei Golubchik21 Nov
  • Re: How to get key info of index?Sergei Golubchik21 Nov
  • Re: How to get key info of index?xiao.feng21 Nov
    • Re: How to get key info of index?Paul McCullagh22 Nov
Re: How to get key info of index?Paul McCullagh22 Nov
  • Re: How to get key info of index?Martin Skold22 Nov
RE: How to get key info of index?xiao.feng28 Nov
  • Pushdown conditions (was: RE: How to get key info of index?)Stewart Smith29 Nov
  • Re: How to get key info of index?Martin Skold29 Nov
  • Re: How to get key info of index?xiao.feng30 Nov