summaryrefslogtreecommitdiff
path: root/storage/maria/ma_unique.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-01-14 11:37:23 +0100
committerSergei Golubchik <sergii@pisem.net>2011-01-14 11:37:23 +0100
commitfba96f7ccdd6661caa90ed345c3df2fe35ffdebd (patch)
tree2f74e371ebc894862e145ee808577ea6822a95ab /storage/maria/ma_unique.c
parent3d5868c68214ac3a8e4c6d77834ca8205d7d3a49 (diff)
downloadmariadb-git-fba96f7ccdd6661caa90ed345c3df2fe35ffdebd.tar.gz
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.
Diffstat (limited to 'storage/maria/ma_unique.c')
-rw-r--r--storage/maria/ma_unique.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c
index a90578c2162..0c7a2a3cbcf 100644
--- a/storage/maria/ma_unique.c
+++ b/storage/maria/ma_unique.c
@@ -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;
}