From: MARK CALLAGHAN Date: May 14 2009 1:18pm Subject: Re: Handling of keypart_map in custom storage engine List-Archive: http://lists.mysql.com/internals/36688 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Thu, May 14, 2009 at 3:09 AM, Sergei Golubchik wrote: > Hi, Vyacheslav! > > On May 13, Vyacheslav Akhmechet wrote: >> Hi, >> >> When the server calles index_read and related functions, it passes >> keypart_map which indicates which parts of the key are present. I'm >> not completely sure how to handle the implementation of this - if the >> semantics of keypart_map are such that any of the bits may be set or >> unset, I don't know how an efficient implementation can be possible. >> >> Suppose a given key has two parts, A and B, and I build an index on >> this key (by combining A and B in lexicographic order, or a similar >> technique). Now, suppose index_read is called, and part A is missing >> from the key. In this case the index is essentially useless - I need >> to do a full table scan. I don't see how one could implement an index >> to get around this. >> >> Am I misunderstanding the purpose/semantics of keypart_map? > > No, you are not. Btree indexes, indeed, cannot support this feature. > Bitmap indexes, I presume, can. Btrees can and do support index scans in this case. Check out index skip scan in Oracle. http://www.google.com/search?q=index+skip+scan -- Mark Callaghan mdcallag@stripped