Eliminate NAME_CONST to Allow Index Usage
This is the problem code in my stored function:
SET current_first_name = 'Joe';
SELECT id INTO current_id FROM names WHERE first_name = current_first_name LIMIT 1;
When Mysql is executing the statement, it gets rewritten as this and cannot use indexes:
SELECT id INTO current_id FROM names WHERE first_name = NAME_CONST( 'current_first_name', _utf8 'Joe' COLLATE 'utf8_unicode_ci' ) LIMIT 1;
How can I fix? The names table is utf8_unicode_ci, but the first_name column is ascii_general_ci.
Relevant ini params:
character-set-server=utf8
collation-server=utf8_unicode_ci
init-connect='SET NAMES utf8'
Subject
Views
Written By
Posted
Eliminate NAME_CONST to Allow Index Usage
10274
April 17, 2013 09:26AM
3636
April 17, 2013 04:55PM
4100
April 17, 2013 04:59PM
3138
April 18, 2013 08:28AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.