Re: Temporarily preventing index from being selected

Sergei Golubchik <[email protected]>
Newsgroups gmane.comp.db.mysql.devel
Message-ID <[email protected]>
Hi, Olivier!

On Jun 23, Olivier Chédru wrote:
> Hi Yves,
> 
> You are right, if I return ((ha_rows)~0 - 1) the index is not selected.
> However, is there any guarantee this will be always the case?

There's no guarantee, and furthermore, MySQL doesn't always call
records_in_range() before using an index.

The correct approach is to mask this key out in the
TABLE_SHARE::keys_in_use bitmap.

Regards,
Sergei

> -----Original Message-----
> From: Yves Trudeau [mailto:[email protected]] 
> Sent: Thursday, June 23, 2011 2:25 PM
> To: Olivier Chédru
> Cc: [email protected]
> Subject: Re: Temporarily preventing index from being selected
> 
> Hi Olivier,
>   Have you tried returning a very large number.  That would hint not to
> use the index.
> 
> On Thu, 2011-06-23 at 12:03 +0200, Olivier Chédru wrote:
> > Hi!
> > 
> > I am developing a storage engine for MySQL 5.5. My storage engine is
> > able to perform online index alterations.
> > 
> > I would like to prevent MySQL from choosing an index currently being
> > added by the storage engine.
> > 
> > To do so, my handler::records_in_range() method returns HA_POS_ERROR.
> > However this does not work: the index is used by the query anyway.
> > 
> > Any idea about how to achieve that?
> > 

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.