drizzle-discuss team mailing list archive
Mailing list archive
HA_KEYTYPE_VARTEXT1 and HA_KEYTYPE_VARTEXT2
I was looking through index key handling code and discovered the
The first question that popped in my mind was "What on earth is the
difference between these?". So, I did some grepping and found some
interesting things about them.
Firstly, these are only used in MyISAM and HEAP only. Here's the list
of files in the kernel that uses it (defined in base.h). It seems
hardly used too.
Secondly, according to this comment in varchar.cc: "When VARCHAR is
stored in a key (for handler::index_read() etc) it's always stored
with a 2 byte prefix. (Just like blob keys).", this line of code:
res= length_bytes == 1 ? HA_KEYTYPE_VARTEXT1 : HA_KEYTYPE_VARTEXT2;
in drizzled/field/varstring.cc doesn't make sense to me (because it's
mentioned that the length of the variable length textual data for keys
is represented with 2 bytes). So, my speculation is that
HA_KEYTYPE_VARTEXT1 represents a varchar that has a length
representation of 1 byte.
Since MyISAM and HEAP are about the only engines that uses this enum,
would it make sense to consider removing VARTEXT1 and make VARTEXT2,
"the one"?. I understand that this area of the code could be delicate
so I sent this email to see what you all think of this.
Toru Maesaka <dev@xxxxxxxxx>