Added to Aria better hash for packed numeric data for unique handling.

This was needed as the old code caused us to have LOTS of duplicate
hash values when used by optimizer.

include/m_ctype.h:
  Made my_hash_sort_bin() exernal
storage/maria/ma_unique.c:
  Better hash for packed numeric data for unique handling.
  This was needed as the old code caused us to have LOTS
  of duplicate hash values when used by optimizer.
This commit is contained in:
Sergei Golubchik 2011-01-14 11:37:23 +01:00
parent 3d5868c682
commit fba96f7ccd
2 changed files with 9 additions and 5 deletions

View File

@ -357,6 +357,9 @@ extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, size_t,
extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, size_t len,
ulong *nr1, ulong *nr2);
extern void my_hash_sort_bin(CHARSET_INFO *cs,
const uchar *key, size_t len, ulong *nr1,
ulong *nr2);
extern size_t my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, size_t length);

View File

@ -134,13 +134,14 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record)
keyseg->charset->coll->hash_sort(keyseg->charset,
(const uchar*) pos, length, &seed1,
&seed2);
crc^= seed1;
crc+= seed1;
}
else
while (pos != end)
crc=((crc << 8) +
(((uchar) *pos++))) +
(crc >> (8*sizeof(ha_checksum)-8));
{
my_hash_sort_bin((CHARSET_INFO*) 0, pos, (size_t) (end-pos),
&seed1, &seed2);
crc+= seed1;
}
}
return crc;
}