summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2004-06-10 01:30:39 +0400
committerkonstantin@mysql.com <>2004-06-10 01:30:39 +0400
commite64b38e8bcc955cb7b8f543f24cc4a0c046f3617 (patch)
tree4e84fc20ffbbb0ada96ebc037f4d9d50ad94a09b /myisam
parentaa3c80fb7d1e22f080209f06e6c7d31ed3c85237 (diff)
downloadmariadb-git-e64b38e8bcc955cb7b8f543f24cc4a0c046f3617.tar.gz
Fix for Bug#3904 "COUNT DISTINCT performance anomaly in 4.1"
The bug was caused by error in hash calculation function: it always returned hash value for last field in a composite key, so for keys like (a text, b char(1)) we were always getting bad hash values.
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_unique.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/myisam/mi_unique.c b/myisam/mi_unique.c
index 38b4ed93311..4d82858c9ad 100644
--- a/myisam/mi_unique.c
+++ b/myisam/mi_unique.c
@@ -71,6 +71,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
const byte *pos, *end;
ha_checksum crc=0;
HA_KEYSEG *keyseg;
+ ulong seed= 4;
for (keyseg=def->seg ; keyseg < def->end ; keyseg++)
{
@@ -108,9 +109,8 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
end= pos+length;
if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT)
{
- ulong nr=1, nr2=4;
- keyseg->charset->coll->hash_sort(keyseg->charset,(const uchar*)pos,length,&nr, &nr2);
- crc=nr;
+ keyseg->charset->coll->hash_sort(keyseg->charset,
+ (const uchar*) pos, length, &crc, &seed);
}
else
while (pos != end)