Commit 9bb46448 authored by unknown's avatar unknown
Browse files

CSC#4385: slow sorting for UTF8 large table:

my_strnxfrm_utf8 now requires 2 bytes per character
in filesort key, instead of 3 bytes per character.
Shorter filesort keys make sorting faster.

parent e8ae3383
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ typedef struct my_collation_handler_st
                         my_bool diff_if_only_endspace_difference);
  int     (*strnxfrm)(struct charset_info_st *,
		      uchar *, uint, const uchar *, uint);
  uint    (*strnxfrmlen)(struct charset_info_st *, uint); 
  my_bool (*like_range)(struct charset_info_st *,
			const char *s, uint s_length,
			pchar w_prefix, pchar w_one, pchar w_many, 
@@ -260,6 +261,7 @@ extern CHARSET_INFO my_charset_cp1250_czech_ci;
/* declarations for simple charsets */
extern int  my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *,
                               uint); 
uint  my_strnxfrmlen_simple(CHARSET_INFO *, uint); 
extern int  my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint,
				const uchar *, uint, my_bool);

+2 −2
Original line number Diff line number Diff line
@@ -1187,7 +1187,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
	{
	  sortorder->need_strxnfrm= 1;
	  *multi_byte_charset= 1;
	  sortorder->length= sortorder->length*cs->strxfrm_multiply;
          sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
	}
      }
      if (sortorder->field->maybe_null())
@@ -1200,7 +1200,7 @@ sortlength(SORT_FIELD *sortorder, uint s_length, bool *multi_byte_charset)
	sortorder->length=sortorder->item->max_length;
	if (use_strnxfrm((cs=sortorder->item->collation.collation)))
	{ 
	  sortorder->length= sortorder->length*cs->strxfrm_multiply;
          sortorder->length= cs->coll->strnxfrmlen(cs, sortorder->length);
	  sortorder->need_strxnfrm= 1;
	  *multi_byte_charset= 1;
	}
+1 −0
Original line number Diff line number Diff line
@@ -6293,6 +6293,7 @@ static MY_COLLATION_HANDLER my_collation_big5_chinese_ci_handler =
  my_strnncoll_big5,
  my_strnncollsp_big5,
  my_strnxfrm_big5,
  my_strnxfrmlen_simple,
  my_like_range_big5,
  my_wildcmp_mb,
  my_strcasecmp_mb,
+2 −0
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ MY_COLLATION_HANDLER my_collation_8bit_bin_handler =
    my_strnncoll_8bit_bin,
    my_strnncollsp_8bit_bin,
    my_strnxfrm_8bit_bin,
    my_strnxfrmlen_simple,
    my_like_range_simple,
    my_wildcmp_bin,
    my_strcasecmp_bin,
@@ -461,6 +462,7 @@ static MY_COLLATION_HANDLER my_collation_binary_handler =
    my_strnncoll_binary,
    my_strnncollsp_binary,
    my_strnxfrm_bin,
    my_strnxfrmlen_simple,
    my_like_range_simple,
    my_wildcmp_bin,
    my_strcasecmp_bin,
+1 −0
Original line number Diff line number Diff line
@@ -5454,6 +5454,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
  my_strnncoll_cp932,
  my_strnncollsp_cp932,
  my_strnxfrm_cp932,
  my_strnxfrmlen_simple,
  my_like_range_cp932,
  my_wildcmp_mb,	/* wildcmp  */
  my_strcasecmp_8bit,
Loading