It sounds like you are having an issue with collations.. have you read this?

http://dev.mysql.com/doc/refman/5.1/en/charset-collations.html

As for optimizing a column for LIKE: a normal index for a character
field does indeed accelerate a LIKE expression of the form 'ABC%'
where there is no variable (or few of them) at the start of the
string... in fact, if the variable is too near the beginning of the
string it can degrade index performance.   The efficiency of a LIKE
expression (meaning ability to use an index effectively) is related to
the number of LITERAL characters at the start of the expression
string, and performance will degrade logarithmically the shorted that
initial literal string.

Assuming all latin alphabetic characters, in a large dataset with even
distribution the expression
  LIKE 'abcd%'
will use the index to narrow the data 26 times smaller than the expression
  LIKE 'abc%'

The expression LIKE 'a%' will need to examine 1/26 th of your records
which, if you have a few million, can take awhile.  Of course
something like '%dfg' or '_foo' will never be able to make use of a
conventional index.

 - michael


On 8/15/07, VeeJay <[EMAIL PROTECTED]> wrote:
> Hello there
>
> I have a problem. When I try to select some names starting with extra
> alphabets (Å Æ Ä Ö, etc), I simply don't get required results i.e.,
> if I give a select command like:
>
> select * from employees where fname LIKE 'Å%';
> I get results starting with English alphabet 'A' but not with 'Å'. Which
> also exist in database.
> It happens same with Ä...
>
> Surprisingly, for Ø I can retreive data but not for Ö. For Ö, I get results
> starting with english O... :(
>
> Here is the output of database characterset:
>
> mysql> SHOW VARIABLES LIKE 'character_set%';
> +--------------------------+----------------------------------------+
> | Variable_name            | Value                                  |
> +--------------------------+----------------------------------------+
> | character_set_client     | utf8                                   |
> | character_set_connection | utf8                                   |
> | character_set_database   | utf8                                   |
> | character_set_filesystem | binary                                 |
> | character_set_results    | utf8                                   |
> | character_set_server     | utf8                                   |
> | character_set_system     | utf8                                   |
> | character_sets_dir       | /usr/local/mysql/share/mysql/charsets/ |
> +--------------------------+----------------------------------------+
> 8 rows in set (0.00 sec)
>
> Operating system is FreeBSD 6.2.
> MySQL 5.0
>
>
> Another question: Is there any way to optimize the LIKE or is there any fast
> method to select a column based on starting with a given character?
>
> Thanks for your kind help!
>
>
> --
> Thanks!
>
> BR / vj
>


-- 
 - michael dykman
 - [EMAIL PROTECTED]

 - All models are wrong.  Some models are useful.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to