Hi, Ron!
On Mar 10, Ron Hu wrote:
> Hi,
>
> active_index is a class member variable in MySQL's handler class. MySQL
> query processor uses this variable to tell storage engine which index id it
> is using for a given table. Storage engine may override the index id used
> for a given table used in a SQL statement by assigning a specific index id
> to active_index.
>
> I observed that an instance of handler object is created for each table
> descriptor. A table handler may be shared by two concurrent users if they
> access same table at the same time. Suppose a table t1 has two indexes idx1
no, a table handler may *not* be shared by two concurrent users even if
they access same table at the same time.
> and idx2. User 1 needs to use idx1 while user 2 needs to use idx2. If
> these two users run their queries concurrently, how can MySQL and storage
> engine guarantee the right active_index value is used for two concurrent
> users?
See above, handler objects aren't shared between threads.
Regards / Mit vielen GrЭъen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB MЭnchen 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
GeschДftsfЭhrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin HДring